Skip to content

Commit 8e8b41f

Browse files
committed
no cleanup needed if no pushed locals
1 parent 4c4eebc commit 8e8b41f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Python/compile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5643,7 +5643,7 @@ push_inlined_comprehension_state(struct compiler *c, location loc,
56435643
ADDOP_I(c, loc, SWAP, PyList_GET_SIZE(state->pushed_locals) + 1);
56445644
}
56455645

5646-
if (c->u->u_nfblocks > 0) {
5646+
if (c->u->u_nfblocks > 0 && state->pushed_locals) {
56475647
// If we are inside a try block, we need to add our own cleanup handler
56485648
// to restore comprehension locals, so they have the correct values
56495649
// inside an exception handler or finally block.

0 commit comments

Comments
 (0)