Skip to content

Commit 346852c

Browse files
committed
gh-106797: Reduce warning logs from Python/generated_cases.c.h
1 parent 8c17729 commit 346852c

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
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: 10 additions & 10 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: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ def effect_size(effect: StackEffect) -> tuple[int, str]:
9898
assertnoteffect.cond, "Array effects cannot have a condition"
9999
return0, effect.size
100100
elifeffect.cond:
101+
ifeffect.condin ("0", "1"):
102+
return0, effect.cond
101103
return0, f"{maybe_parenthesize(effect.cond)} ? 1 : 0"
102104
else:
103105
return1, ""
@@ -1077,7 +1079,10 @@ def effect_str(effects: list[StackEffect]) -> str:
10771079
foreffectincomp.instr.output_effects:
10781080
assertnoteffect.size, effect
10791081
ifeffect.cond:
1080-
pushed_symbolic.append(maybe_parenthesize(f"{maybe_parenthesize(effect.cond)} ? 1 : 0"))
1082+
ifeffect.condin ("0", "1"):
1083+
pushed_symbolic.append(effect.cond)
1084+
else:
1085+
pushed_symbolic.append(maybe_parenthesize(f"{maybe_parenthesize(effect.cond)} ? 1 : 0"))
10811086
sp+=1
10821087
high=max(sp, high)
10831088
ifhigh!=max(0, sp):

0 commit comments

Comments
(0)