]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix the closure argument to PyEval_EvalCodeEx. (GH-92175)
authorlarryhastings <larry@hastings.org>
Mon, 2 May 2022 20:08:22 +0000 (13:08 -0700)
committerGitHub <noreply@github.com>
Mon, 2 May 2022 20:08:22 +0000 (14:08 -0600)
Misc/NEWS.d/next/C API/2022-05-02-12-39-33.gh-issue-92173.len2Is.rst [new file with mode: 0644]
Objects/funcobject.c

diff --git a/Misc/NEWS.d/next/C API/2022-05-02-12-39-33.gh-issue-92173.len2Is.rst b/Misc/NEWS.d/next/C API/2022-05-02-12-39-33.gh-issue-92173.len2Is.rst
new file mode 100644 (file)
index 0000000..c8f9b58
--- /dev/null
@@ -0,0 +1 @@
+Fix the ``closure`` argument to :c:func:`PyEval_EvalCodeEx`.
index 1e0cfb7efb479a9932a18d5ee64b333107efac83..32b4155c03e6ae01a06822386a8406a7cd613a55 100644 (file)
@@ -29,7 +29,8 @@ _PyFunction_FromConstructor(PyFrameConstructor *constr)
     op->func_code = constr->fc_code;
     op->func_defaults = NULL;
     op->func_kwdefaults = NULL;
-    op->func_closure = NULL;
+    Py_XINCREF(constr->fc_closure);
+    op->func_closure = constr->fc_closure;
     Py_INCREF(Py_None);
     op->func_doc = Py_None;
     op->func_dict = NULL;