gh-105340: include hidden fast-locals in locals() (#105715)

* gh-105340: include hidden fast-locals in locals()
This commit is contained in:
Carl Meyer 2023-07-05 17:05:02 -06:00 committed by GitHub
parent 838406b4fc
commit 104d7b760f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 160 additions and 44 deletions

View file

@ -2261,6 +2261,19 @@ PyEval_GetLocals(void)
return locals;
}
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)
{