GH-128534: Fix behavior of branch monitoring for async for (GH-130847)

* Both branches in a pair now have a common source and are included in co_branches
This commit is contained in:
Mark Shannon 2025-03-07 14:30:31 +00:00 committed by GitHub
parent e5527f2cdd
commit 89df62c120
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 235 additions and 154 deletions

View file

@ -849,7 +849,7 @@ calculate_stackdepth(cfg_builder *g)
goto error;
}
maxdepth = Py_MAX(maxdepth, depth + effects.max);
if (HAS_TARGET(instr->i_opcode)) {
if (HAS_TARGET(instr->i_opcode) && instr->i_opcode != END_ASYNC_FOR) {
if (get_stack_effects(instr->i_opcode, instr->i_oparg, 1, &effects) < 0) {
PyErr_Format(PyExc_SystemError,
"Invalid stack effect for opcode=%d, arg=%i",