Skip to content

Commit

Permalink
Add missing DECREFs
Browse files Browse the repository at this point in the history
  • Loading branch information
813gan committed Aug 22, 2024
1 parent f61275c commit 6e540fb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions subinterpreter.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
ret = Py_True; \
PyObject_SetItem(global_dict, target_name, obj); \
exception = PyErr_GetRaisedException(); \
Py_DECREF(obj); \
} else { \
ret = obj; \
}
Expand All @@ -36,6 +37,7 @@
if (NULL == exception) { \
return ret; \
} else { \
Py_XDECREF(ret); \
return exception; \
}

Expand Down Expand Up @@ -217,6 +219,7 @@ PyObject *call_function(char *interpreter_name, PyObject *callable_name, PyObjec
PyErr_Clear();
PyObject *builtins_name = PyUnicode_FromString("__builtins__");
PyObject *builtins = PyObject_GetItem(global_dict, builtins_name);
Py_DECREF(builtins_name);
callable = PyObject_GetAttr(builtins, callable_name); // New reference
}

Expand Down

0 comments on commit 6e540fb

Please sign in to comment.