Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e21751f

Browse filesBrowse files
committed
Always pop the new frame after a failed call
1 parent d0b41d1 commit e21751f
Copy full SHA for e21751f

File tree

Expand file treeCollapse file tree

1 file changed

+5
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-1
lines changed

‎Python/ceval.c

Copy file name to clipboardExpand all lines: Python/ceval.c
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6410,7 +6410,7 @@ _PyEvalFramePushAndInit(PyThreadState *tstate, PyFunctionObject *func,
64106410
}
64116411
if (initialize_locals(tstate, func, localsarray, args, argcount, kwnames)) {
64126412
assert(frame->owner != FRAME_OWNED_BY_GENERATOR);
6413-
_PyFrame_Clear(frame);
6413+
_PyEvalFrameClearAndPop(tstate, frame);
64146414
return NULL;
64156415
}
64166416
return frame;
@@ -6432,6 +6432,10 @@ _PyEvalFramePushAndInit(PyThreadState *tstate, PyFunctionObject *func,
64326432
static void
64336433
_PyEvalFrameClearAndPop(PyThreadState *tstate, _PyInterpreterFrame * frame)
64346434
{
6435+
PyObject **base = (PyObject **)frame;
6436+
// Make sure that this is, indeed, the top frame. We can't check this in
6437+
// _PyThreadState_PopFrame, since f_code is already cleared at that point:
6438+
assert(base + frame->f_code->co_framesize == tstate->datastack_top);
64356439
tstate->recursion_remaining--;
64366440
assert(frame->frame_obj == NULL || frame->frame_obj->f_frame == frame);
64376441
assert(frame->owner == FRAME_OWNED_BY_THREAD);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.