Skip to content

Commit 1e36ca6

Browse files
authored
Small fixes to code generator (#106845)
These repair nits I found in PR gh-106798 (issue gh-106797) and in PR gh-106716 (issue gh-106706).
1 parent 00e52ac commit 1e36ca6

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

Include/internal/pycore_opcode_metadata.h

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/generated_cases.c.h

Lines changed: 3 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tools/cases_generator/generate_cases.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def effect_size(effect: StackEffect) -> tuple[int, str]:
9999
return 0, effect.size
100100
elif effect.cond:
101101
if effect.cond in ("0", "1"):
102-
return 0, effect.cond
102+
return int(effect.cond), ""
103103
return 0, f"{maybe_parenthesize(effect.cond)} ? 1 : 0"
104104
else:
105105
return 1, ""
@@ -841,9 +841,9 @@ def map_families(self) -> None:
841841
def check_families(self) -> None:
842842
"""Check each family:
843843
844-
- Must have at least 2 members
845-
- All members must be known instructions
846-
- All members must have the same cache, input and output effects
844+
- Must have at least 2 members (including head)
845+
- Head and all members must be known instructions
846+
- Head and all members must have the same cache, input and output effects
847847
"""
848848
for family in self.families.values():
849849
if family.name not in self.macro_instrs and family.name not in self.instrs:
@@ -868,7 +868,7 @@ def check_families(self) -> None:
868868
self.error(
869869
f"Family {family.name!r} has inconsistent "
870870
f"(cache, input, output) effects:\n"
871-
f" {family.members[0]} = {expected_effects}; "
871+
f" {family.name} = {expected_effects}; "
872872
f"{member} = {member_effects}",
873873
family,
874874
)

0 commit comments

Comments
 (0)