From 3140a4d61746799ca5416918e5a4632606a74202 Mon Sep 17 00:00:00 2001 From: Jared Miller Date: Tue, 10 Feb 2026 17:16:25 -0500 Subject: [PATCH] Add return_addr to ZStackBottom for uniform frame access ZStackBottom already had stack and local_vars for uniform treatment, but was missing return_addr. Adding it removes 5 type: ignore suppressions and fixes all ty possibly-missing-attribute warnings. --- src/mudlib/zmachine/zstackmanager.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mudlib/zmachine/zstackmanager.py b/src/mudlib/zmachine/zstackmanager.py index 18ea0fb..d37e76d 100644 --- a/src/mudlib/zmachine/zstackmanager.py +++ b/src/mudlib/zmachine/zstackmanager.py @@ -104,6 +104,7 @@ class ZStackBottom: def __init__(self): self.program_counter = 0 # used as a cache only + self.return_addr = None self.stack = [] self.local_vars = [0 for _ in range(15)] @@ -201,15 +202,14 @@ class ZStackManager: current_routine = self._call_stack[-1] # Depending on many things, return stuff. - if exiting_routine.return_addr is not None: # type: ignore[possibly-missing-attribute] - if exiting_routine.return_addr == 0: # type: ignore[possibly-missing-attribute] + if exiting_routine.return_addr is not None: + if exiting_routine.return_addr == 0: # Push to stack self.push_stack(return_value) - elif 0 < exiting_routine.return_addr < 0x10: # type: ignore[possibly-missing-attribute] + elif 0 < exiting_routine.return_addr < 0x10: # Store in local var - self.set_local_variable(exiting_routine.return_addr - 1, return_value) # type: ignore[possibly-missing-attribute] + self.set_local_variable(exiting_routine.return_addr - 1, return_value) else: # Store in global var - self._memory.write_global(exiting_routine.return_addr, return_value) # type: ignore[possibly-missing-attribute] - + self._memory.write_global(exiting_routine.return_addr, return_value) return current_routine.program_counter