diff options
author | Carl Meyer <carl@oddbird.net> | 2023-07-05 23:05:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-05 23:05:02 (GMT) |
commit | 104d7b760fed18055e4f04e5da3ca619e28bfc81 (patch) | |
tree | a193506aff9bf86f46c51db47cd6cd9d74875714 /Python/ceval.c | |
parent | 838406b4fc044c0b2f397c23275c69f16a76205b (diff) | |
download | cpython-104d7b760fed18055e4f04e5da3ca619e28bfc81.zip cpython-104d7b760fed18055e4f04e5da3ca619e28bfc81.tar.gz cpython-104d7b760fed18055e4f04e5da3ca619e28bfc81.tar.bz2 |
gh-105340: include hidden fast-locals in locals() (#105715)
* gh-105340: include hidden fast-locals in locals()
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index 9bcb83f..6714229 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -2262,6 +2262,19 @@ PyEval_GetLocals(void) } PyObject * +_PyEval_GetFrameLocals(void) +{ + PyThreadState *tstate = _PyThreadState_GET(); + _PyInterpreterFrame *current_frame = _PyThreadState_GetFrame(tstate); + if (current_frame == NULL) { + _PyErr_SetString(tstate, PyExc_SystemError, "frame does not exist"); + return NULL; + } + + return _PyFrame_GetLocals(current_frame, 1); +} + +PyObject * PyEval_GetGlobals(void) { PyThreadState *tstate = _PyThreadState_GET(); |