[Python-checkins] gh-105481: Fix types and a bug for pseudos (#105788)

gvanrossum webhook-mailer at python.org
Wed Jun 14 13:07:00 EDT 2023


https://github.com/python/cpython/commit/d50930a6a846280b5da299f9c2f9a01669dbf06c
commit: d50930a6a846280b5da299f9c2f9a01669dbf06c
branch: main
author: Guido van Rossum <guido at python.org>
committer: gvanrossum <gvanrossum at gmail.com>
date: 2023-06-14T10:06:50-07:00
summary:

gh-105481: Fix types and a bug for pseudos (#105788)

files:
M Tools/cases_generator/generate_cases.py

diff --git a/Tools/cases_generator/generate_cases.py b/Tools/cases_generator/generate_cases.py
index 8aa500e9e741..8d5739f307ab 100644
--- a/Tools/cases_generator/generate_cases.py
+++ b/Tools/cases_generator/generate_cases.py
@@ -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 @@ def error(self, msg: str, node: parser.Node) -> None:
     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 @@ def parse_file(self, filename: str, instrs_idx: dict[str, int]) -> None:
 
         # 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 @@ def effect_str(effects: list[StackEffect]) -> str:
                 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.



More information about the Python-checkins mailing list