mirror of
https://github.com/python/cpython.git
synced 2025-10-21 06:02:21 +00:00
GH-100126: Skip incomplete frames in more places (GH-100613)
This commit is contained in:
parent
2e80c2a976
commit
61762b9387
12 changed files with 62 additions and 46 deletions
|
@ -2749,16 +2749,13 @@ _PyInterpreterFrame *
|
|||
_PyEval_GetFrame(void)
|
||||
{
|
||||
PyThreadState *tstate = _PyThreadState_GET();
|
||||
return tstate->cframe->current_frame;
|
||||
return _PyThreadState_GetFrame(tstate);
|
||||
}
|
||||
|
||||
PyFrameObject *
|
||||
PyEval_GetFrame(void)
|
||||
{
|
||||
_PyInterpreterFrame *frame = _PyEval_GetFrame();
|
||||
while (frame && _PyFrame_IsIncomplete(frame)) {
|
||||
frame = frame->previous;
|
||||
}
|
||||
if (frame == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2772,7 +2769,7 @@ PyEval_GetFrame(void)
|
|||
PyObject *
|
||||
_PyEval_GetBuiltins(PyThreadState *tstate)
|
||||
{
|
||||
_PyInterpreterFrame *frame = tstate->cframe->current_frame;
|
||||
_PyInterpreterFrame *frame = _PyThreadState_GetFrame(tstate);
|
||||
if (frame != NULL) {
|
||||
return frame->f_builtins;
|
||||
}
|
||||
|
@ -2811,7 +2808,7 @@ PyObject *
|
|||
PyEval_GetLocals(void)
|
||||
{
|
||||
PyThreadState *tstate = _PyThreadState_GET();
|
||||
_PyInterpreterFrame *current_frame = tstate->cframe->current_frame;
|
||||
_PyInterpreterFrame *current_frame = _PyThreadState_GetFrame(tstate);
|
||||
if (current_frame == NULL) {
|
||||
_PyErr_SetString(tstate, PyExc_SystemError, "frame does not exist");
|
||||
return NULL;
|
||||
|
@ -2830,7 +2827,7 @@ PyObject *
|
|||
PyEval_GetGlobals(void)
|
||||
{
|
||||
PyThreadState *tstate = _PyThreadState_GET();
|
||||
_PyInterpreterFrame *current_frame = tstate->cframe->current_frame;
|
||||
_PyInterpreterFrame *current_frame = _PyThreadState_GetFrame(tstate);
|
||||
if (current_frame == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue