8000 GH-131729: Consider in-memory state when merging storage and stack by markshannon · Pull Request #131773 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-131729: Consider in-memory state when merging storage and stack #131773

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Python/executor_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Python/generated_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Tools/cases_generator/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,8 @@ def merge(self, other: "Stack", out: CWriter) -> None:
if self_var.memory_offset is not None:
if self_var.memory_offset != other_var.memory_offset:
raise StackError(f"Mismatched stack depths for {self_var.name}: {self_var.memory_offset} and {other_var.memory_offset}")
elif other_var.memory_offset is None:
self_var.memory_offset = None


def stacks(inst: Instruction | PseudoInstruction) -> Iterator[StackEffect]:
Expand Down Expand Up @@ -601,6 +603,11 @@ def merge(self, other: "Storage", out: CWriter) -> None:
if len(self.outputs) != len(other.outputs):
var = self.outputs[0] if len(self.outputs) > len(other.outputs) else other.outputs[0]
raise StackError(f"'{var.name}' is set on some paths, but not all")
for var, other_var in zip(self.outputs, other.outputs):
if var.memory_offset is None:
other_var.memory_offset = None
elif other_var.memory_offset is None:
var.memory_offset = None
self.stack.merge(other.stack, out)
self.sanity_check()

Expand Down
Loading
0