Skip to content

Commit

Permalink
Remove asserts that confuse enum _framestate with enum _frameowner
Browse files Browse the repository at this point in the history
The owner field of _PyInterpreterFrame is supposed to be a member of
enum _frameowner, but FRAME_CLEARED is a member of enum _framestate.
At present, it happens that FRAME_CLEARED is not numerically equal to
any member of enum _frameowner, but that could change in the future.
The code that incorrectly assigned owner = FRAME_CLEARED was deleted
in commit a53cc3f (pythonGH-116687).
Remove the incorrect checks for owner != FRAME_CLEARED as well.

Signed-off-by: Anders Kaseorg <[email protected]>
  • Loading branch information
andersk committed Sep 16, 2024
1 parent a9c2bc1 commit 0d70eb1
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions Python/frame.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ _PyFrame_MakeAndSetFrameObject(_PyInterpreterFrame *frame)
// here.
assert(frame->frame_obj == NULL);
assert(frame->owner != FRAME_OWNED_BY_FRAME_OBJECT);
assert(frame->owner != FRAME_CLEARED);
f->f_frame = frame;
frame->frame_obj = f;
return f;
Expand All @@ -54,7 +53,6 @@ take_ownership(PyFrameObject *f, _PyInterpreterFrame *frame)
{
assert(frame->owner != FRAME_OWNED_BY_CSTACK);
assert(frame->owner != FRAME_OWNED_BY_FRAME_OBJECT);
assert(frame->owner != FRAME_CLEARED);
Py_ssize_t size = ((char*)frame->stackpointer) - (char *)frame;
memcpy((_PyInterpreterFrame *)f->_f_frame_data, frame, size);
frame = (_PyInterpreterFrame *)f->_f_frame_data;
Expand Down

0 comments on commit 0d70eb1

Please sign in to comment.