]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-105481: Fix types and a bug for pseudos (#105788)
authorGuido van Rossum <guido@python.org>
Wed, 14 Jun 2023 17:06:50 +0000 (10:06 -0700)
committerGitHub <noreply@github.com>
Wed, 14 Jun 2023 17:06:50 +0000 (10:06 -0700)
Tools/cases_generator/generate_cases.py

index 8aa500e9e7412af54534dc27b3882d9a060c5234..8d5739f307abf2cec25a8fad13a3be4a0789e1a8 100644 (file)
@@ -510,7 +510,7 @@ class OverriddenInstructionPlaceHolder:
     name: str
 
 
-AnyInstruction = Instruction | MacroInstruction
+AnyInstruction = Instruction | MacroInstruction | PseudoInstruction
 INSTR_FMT_PREFIX = "INSTR_FMT_"
 INSTR_FLAG_SUFFIX = "_FLAG"
 
@@ -550,6 +550,7 @@ class Analyzer:
     macros: dict[str, parser.Macro]
     macro_instrs: dict[str, MacroInstruction]
     families: dict[str, parser.Family]
+    pseudos: dict[str, parser.Pseudo]
     pseudo_instrs: dict[str, PseudoInstruction]
 
     def parse(self) -> None:
@@ -607,7 +608,7 @@ class Analyzer:
 
         # Parse from start
         psr.setpos(start)
-        thing: parser.InstDef | parser.Macro | parser.Family | None
+        thing: parser.InstDef | parser.Macro | parser.Pseudo | parser.Family | None
         thing_first_token = psr.peek()
         while thing := psr.definition():
             if ws := [w for w in RESERVED_WORDS if variable_used(thing, w)]:
@@ -927,7 +928,7 @@ class Analyzer:
                 popped = str(-low)
                 pushed = str(sp - low)
             case parser.Pseudo():
-                instr = self.pseudos[thing.name]
+                instr = self.pseudo_instrs[thing.name]
                 popped = pushed = None
                 # Calculate stack effect, and check that it's the the same
                 # for all targets.