Skip to content

Commit

Permalink
[SOT][3.11] Increase ref of func to avoid segmentation fault (PaddleP…
Browse files Browse the repository at this point in the history
  • Loading branch information
SigureMo authored Oct 26, 2023
1 parent 21c4ad5 commit cf6032b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions paddle/fluid/pybind/eval_frame.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ inline static PyObject *eval_custom_code_py311_plus(PyThreadState *tstate,
// Create a new function object from code object. Refer to MAKE_FUNCTION.
PyFunctionObject *func =
(PyFunctionObject *)PyFunction_New((PyObject *)code, frame->f_globals);
Py_INCREF(func);
#if PY_VERSION_HEX < 0x030c0000
Py_XINCREF(frame->f_func->func_closure);
func->func_closure = frame->f_func->func_closure;
Expand Down

0 comments on commit cf6032b

Please sign in to comment.