summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2024-08-06 21:01:44 (GMT)
committerGitHub <noreply@github.com>2024-08-06 21:01:44 (GMT)
commit4767a6e31c0550836b2af45d27e374e721f0c4e6 (patch)
treeac83bad530ad3f874446adb1c51311bacec48d89 /Python
parent5b8a6c5186be299d96dd483146dc6ea737ffdfe7 (diff)
downloadcpython-4767a6e31c0550836b2af45d27e374e721f0c4e6.zip
cpython-4767a6e31c0550836b2af45d27e374e721f0c4e6.tar.gz
cpython-4767a6e31c0550836b2af45d27e374e721f0c4e6.tar.bz2
gh-122728: Fix SystemError in PyEval_GetLocals() (#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().
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index f1663ee..c685a95 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -2499,7 +2499,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;