mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
[3.13] gh-122728: Fix SystemError in PyEval_GetLocals() (GH-122735) (#122757)
gh-122728: Fix SystemError in PyEval_GetLocals() (GH-122735)
Fix PyEval_GetLocals() to avoid SystemError ("bad argument to
internal function"). Don't redefine the 'ret' variable in the if
block.
Add an unit test on PyEval_GetLocals().
(cherry picked from commit 4767a6e31c
)
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
e808146af1
commit
5c161cb832
4 changed files with 23 additions and 1 deletions
|
@ -2482,7 +2482,7 @@ PyEval_GetLocals(void)
|
|||
PyFrameObject *f = _PyFrame_GetFrameObject(current_frame);
|
||||
PyObject *ret = f->f_locals_cache;
|
||||
if (ret == NULL) {
|
||||
PyObject *ret = PyDict_New();
|
||||
ret = PyDict_New();
|
||||
if (ret == NULL) {
|
||||
Py_DECREF(locals);
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue