[3.10] gh-92311: Let frame_setlineno jump over listcomps (GH-92717)

This commit is contained in:
Dennis Sweeney 2022-05-12 11:31:43 -04:00 committed by GitHub
parent 5d62759f98
commit a24e676973
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 1 deletions

View file

@ -195,7 +195,10 @@ markblocks(PyCodeObject *code_obj, int len)
break;
case GET_ITER:
case GET_AITER:
block_stack = push_block(block_stack, Loop);
// For-loops get a Loop block, but comprehensions do not.
if (_Py_OPCODE(code[i + 1]) != CALL_FUNCTION) {
block_stack = push_block(block_stack, Loop);
}
blocks[i+1] = block_stack;
break;
case FOR_ITER: