Skip to content

Commit b22f9d6

Browse files
authored
[3.11] gh-94438: in frameobject's mark_stacks switch, the PUSH_EXC_INFO and POP_EXCEPT cases are no longer reachable (GH-94582) (GH-94595)
(cherry picked from commit 50b9a77) Co-authored-by: Irit Katriel <[email protected]>
1 parent 5f4a16b commit b22f9d6

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

Objects/frameobject.c

+10-8
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,6 @@ mark_stacks(PyCodeObject *code_obj, int len)
256256
stacks[i+1] = next_stack;
257257
break;
258258
}
259-
case POP_EXCEPT:
260-
next_stack = pop_value(pop_value(pop_value(next_stack)));
261-
stacks[i+1] = next_stack;
262-
break;
263259
case SEND:
264260
j = get_arg(code, i) + i + 1;
265261
assert(j < len);
@@ -304,10 +300,16 @@ mark_stacks(PyCodeObject *code_obj, int len)
304300
stacks[i+1] = next_stack;
305301
break;
306302
case PUSH_EXC_INFO:
307-
next_stack = push_value(next_stack, Except);
308-
next_stack = push_value(next_stack, Except);
309-
next_stack = push_value(next_stack, Except);
310-
stacks[i+1] = next_stack;
303+
case POP_EXCEPT:
304+
/* These instructions only appear in exception handlers, which
305+
* skip this switch ever since the move to zero-cost exceptions
306+
* (their stack remains UNINITIALIZED because nothing sets it).
307+
*
308+
* Note that explain_incompatible_stack interprets an
309+
* UNINITIALIZED stack as belonging to an exception handler.
310+
*/
311+
Py_UNREACHABLE();
312+
break;
311313
case RETURN_VALUE:
312314
case RAISE_VARARGS:
313315
case RERAISE:

0 commit comments

Comments
 (0)