aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Tools
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2025-03-27 08:32:45 +0000
committerGitHub <noreply@github.com>2025-03-27 08:32:45 +0000
commitd836d287a7bd1392f6d011888a7469854b0f4325 (patch)
tree8c4583a9c077b4e25dd495021c48a518be093afa /Tools
parent316938bddf1d321234debecc4561d8f5cd6403a0 (diff)
downloadcpython-d836d287a7bd1392f6d011888a7469854b0f4325.tar.gz
cpython-d836d287a7bd1392f6d011888a7469854b0f4325.zip
GH-131729: Consider in-memory state when merging storage and stack (GH-131773)
Diffstat (limited to 'Tools')
-rw-r--r--Tools/cases_generator/stack.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Tools/cases_generator/stack.py b/Tools/cases_generator/stack.py
index 62253ccb5e2..94a5d395064 100644
--- a/Tools/cases_generator/stack.py
+++ b/Tools/cases_generator/stack.py
@@ -378,6 +378,8 @@ class Stack:
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]:
@@ -601,6 +603,11 @@ class Storage:
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()