diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-08-06 21:37:10 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-06 21:37:10 (GMT) |
commit | 5c161cb8329c941aa219dc34c56afa368516d6fb (patch) | |
tree | 819abfe98db80b0e0f776c05e8211adac5e6319e /Python/ceval.c | |
parent | e808146af1841abc7d5f86470041d3ef7712050e (diff) | |
download | cpython-5c161cb8329c941aa219dc34c56afa368516d6fb.zip cpython-5c161cb8329c941aa219dc34c56afa368516d6fb.tar.gz cpython-5c161cb8329c941aa219dc34c56afa368516d6fb.tar.bz2 |
[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 4767a6e31c0550836b2af45d27e374e721f0c4e6)
Co-authored-by: Victor Stinner <vstinner@python.org>
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index 866328e..351ddd2 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -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; |