Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fa8434b

Browse files
committed
Handle no memory case
1 parent 47534f3 commit fa8434b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Modules/gcmodule.c

+6
Original file line numberDiff line numberDiff line change
@@ -1390,6 +1390,12 @@ invoke_gc_callback(PyThreadState *tstate, const char *phase,
13901390
}
13911391

13921392
PyObject *phase_obj = PyUnicode_FromString(phase);
1393+
if (phase_obj == NULL) {
1394+
Py_XDECREF(info);
1395+
PyErr_WriteUnraisable(NULL);
1396+
return;
1397+
}
1398+
13931399
PyObject *stack[] = {phase_obj, info};
13941400
for (Py_ssize_t i=0; i<PyList_GET_SIZE(gcstate->callbacks); i++) {
13951401
PyObject *r, *cb = PyList_GET_ITEM(gcstate->callbacks, i);

0 commit comments

Comments
 (0)