diff options
author | Victor Stinner <vstinner@python.org> | 2021-03-18 13:51:24 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-18 13:51:24 (GMT) |
commit | fc980e0be19776ee05dfc5380eb5d6a8092935cb (patch) | |
tree | c0787fde92f0cdd00c609c5089be97fad7d01618 /Objects | |
parent | 6af528b4ab342805534c0bfe61d84ed7bb519468 (diff) | |
download | cpython-fc980e0be19776ee05dfc5380eb5d6a8092935cb.zip cpython-fc980e0be19776ee05dfc5380eb5d6a8092935cb.tar.gz cpython-fc980e0be19776ee05dfc5380eb5d6a8092935cb.tar.bz2 |
bpo-43541: Fix PyEval_EvalCodeEx() regression (GH-24918)
* Remove an assertion which required CO_NEWLOCALS and CO_OPTIMIZED
code flags. It is ok to call this function on a code with these
flags set.
* Fix reference counting on builtins: remove Py_DECREF().
Fix regression introduced in the
commit 46496f9d12582bf11f4911ad0f23315d6f277907.
Add also a comment to document that _PyEval_BuiltinsFromGlobals()
returns a borrowed reference.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/frameobject.c | 2 | ||||
-rw-r--r-- | Objects/funcobject.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/Objects/frameobject.c b/Objects/frameobject.c index 056d42a..a1413d7 100644 --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -847,7 +847,7 @@ PyFrameObject* PyFrame_New(PyThreadState *tstate, PyCodeObject *code, PyObject *globals, PyObject *locals) { - PyObject *builtins = _PyEval_BuiltinsFromGlobals(tstate, globals); + PyObject *builtins = _PyEval_BuiltinsFromGlobals(tstate, globals); // borrowed ref if (builtins == NULL) { return NULL; } diff --git a/Objects/funcobject.c b/Objects/funcobject.c index 36df88a..45135a8 100644 --- a/Objects/funcobject.c +++ b/Objects/funcobject.c @@ -50,7 +50,7 @@ PyFunction_NewWithQualName(PyObject *code, PyObject *globals, PyObject *qualname } Py_XINCREF(module); - builtins = _PyEval_BuiltinsFromGlobals(tstate, globals); + builtins = _PyEval_BuiltinsFromGlobals(tstate, globals); // borrowed ref if (builtins == NULL) { goto error; } |