summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index e48586d..08fc27f 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -4152,8 +4152,11 @@ _PyEval_EvalCodeWithName(PyObject *_co, PyObject *globals, PyObject *locals,
} else {
gen = PyGen_NewWithQualName(f, name, qualname);
}
- if (gen == NULL)
+ if (gen == NULL) {
+ Py_DECREF(f);
return NULL;
+ }
+ _PyObject_GC_TRACK(f);
if (is_coro && coro_wrapper != NULL) {
PyObject *wrapped;