FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-98831: Fix two bugs in case generator by gvanrossum · Pull Request #101349 · python/cpython · GitHub

/ cpython Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
10 changes: 7 additions & 3 deletions Tools/cases_generator/generate_cases.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ def stack_analysis(

def get_stack_effect_info(
self, thing: parser.InstDef | parser.Super | parser.Macro
) -> tuple[Instruction, str, str]:
) -> tuple[Instruction|None, str, str]:

def effect_str(effect: list[StackEffect]) -> str:
if getattr(thing, 'kind', None) == 'legacy':
Expand All @@ -752,6 +752,9 @@ def effect_str(effect: list[StackEffect]) -> str:
instr = self.instrs[thing.name]
popped = effect_str(instr.input_effects)
pushed = effect_str(instr.output_effects)
else:
instr = None
popped = pushed = "", ""
case parser.Super():
instr = self.super_instrs[thing.name]
popped = '+'.join(effect_str(comp.instr.input_effects) for comp in instr.parts)
Expand All @@ -770,8 +773,9 @@ def write_stack_effect_functions(self) -> None:
pushed_data = []
for thing in self.everything:
instr, popped, pushed = self.get_stack_effect_info(thing)
popped_data.append( (instr, popped) )
pushed_data.append( (instr, pushed) )
if instr is not None:
popped_data.append( (instr, popped) )
pushed_data.append( (instr, pushed) )

def write_function(direction: str, data: list[tuple[Instruction, str]]) -> None:
self.out.emit("\n#ifndef NDEBUG");
Expand Down
3 changes: 1 addition & 2 deletions Tools/cases_generator/test_generator.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,7 @@ def test_macro_instruction():
{
PyObject *arg1 = _tmp_1;
PyObject *interim;
uint16_t counter = re
ad_u16(&next_instr[0].cache);
uint16_t counter = read_u16(&next_instr[0].cache);
interim = op1(arg1);
_tmp_1 = interim;
}
Expand Down

Back | FazBrowse Home | New Git URL