[3.9] gh-92311: Let frame_setlineno jump over listcomps (#92740)

This commit is contained in:
Dennis Sweeney 2022-05-12 17:41:34 -04:00 committed by GitHub
parent f6bd1bd19a
commit 801f77119d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 1 deletions

View file

@ -173,7 +173,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: