mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-126211: Exclude preprocessor directives from statements containing escaping calls (#126213)
The cases generator inserts code to save and restore the stack pointer around statements that contain escaping calls. To find the beginning of such statements, we would walk backwards from the escaping call until we encountered a token that was treated as a statement terminator. This set of terminators should include preprocessor directives.
This commit is contained in:
parent
32e07fd377
commit
821759d631
2 changed files with 34 additions and 1 deletions
|
@ -637,7 +637,7 @@ def find_stmt_start(node: parser.InstDef, idx: int) -> lexer.Token:
|
|||
assert idx < len(node.block.tokens)
|
||||
while True:
|
||||
tkn = node.block.tokens[idx-1]
|
||||
if tkn.kind in {"SEMI", "LBRACE", "RBRACE"}:
|
||||
if tkn.kind in {"SEMI", "LBRACE", "RBRACE", "CMACRO"}:
|
||||
break
|
||||
idx -= 1
|
||||
assert idx > 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue