Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit bb7b88b

Browse files
author
Anselm Kruis
committed
Stackless issue #270: Simplify ceval.c HANDLE_UNWINDING
Remove unreachable code.
1 parent 91ee09b commit bb7b88b

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

Python/ceval.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,9 @@ do { \
603603
assert(SLP_FRAME_EXECUTING_VALUE == f->f_executing); \
604604
if (frame_func != SLP_FRAME_EXECUTING_VALUE) { \
605605
f->f_executing = (frame_func); \
606+
/* check argument: must be an executing frame with retval */ \
607+
assert(frame_func != SLP_FRAME_EXECUTING_NOVAL); \
608+
assert(SLP_FRAME_IS_EXECUTING(f)); \
606609
} \
607610
/* keep the reference to the frame to be called. */ \
608611
f->f_stacktop = stack_pointer; \
@@ -622,9 +625,7 @@ do { \
622625
(retval__) = CALL_FRAME_FUNCTION(f2, 0, (retval__)); \
623626
Py_DECREF(f2); \
624627
if (SLP_PEEK_NEXT_FRAME(tstate) != f) { \
625-
assert(SLP_FRAME_IS_EXECUTING(f)); \
626-
if (f->f_executing == SLP_FRAME_EXECUTING_NOVAL) \
627-
f->f_executing = SLP_FRAME_EXECUTING_VALUE; \
628+
assert(f->f_executing == (frame_func)); \
628629
LLTRACE_HANDLE_UNWINDING(STACKLESS_RETVAL((tstate), (retval__)), "handle_unwinding return from next frame:");\
629630
return (retval__); \
630631
} \
@@ -635,12 +636,7 @@ do { \
635636
if (STACKLESS_UNWINDING(retval__)) \
636637
STACKLESS_UNPACK(tstate, (retval__)); \
637638
f->f_stacktop = NULL; \
638-
if (frame_func != SLP_FRAME_EXECUTING_VALUE) { \
639-
assert(f->f_executing == (frame_func)); \
640-
} \
641-
else { \
642-
assert(f->f_executing == SLP_FRAME_EXECUTING_VALUE || f->f_executing == SLP_FRAME_EXECUTING_NOVAL); \
643-
} \
639+
assert(f->f_executing == (frame_func)); \
644640
f->f_executing = SLP_FRAME_EXECUTING_VALUE; \
645641
if (has_opcode) \
646642
next_instr += 1 + EXTENDED_ARG_OFFSET(oparg); \

0 commit comments

Comments
 (0)