From b4f8864e56a3ed5f8d8304f0b1ac50d63d4ad761 Mon Sep 17 00:00:00 2001 From: Kay Hayen Date: Sat, 29 Nov 2025 11:41:28 +0000 Subject: [PATCH] Backport: These changes need to be manually distributed to previous commits --- nuitka/Variables.py | 8 ++++++++ nuitka/nodes/LocalsScopes.py | 7 ++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/nuitka/Variables.py b/nuitka/Variables.py index 5d00d4bc4..c27c8af44 100644 --- a/nuitka/Variables.py +++ b/nuitka/Variables.py @@ -456,6 +456,14 @@ class LocalsDictVariable(Variable): else: return trace_collection.initVariableUnknown(self, None) + def inhibitsClassScopeForwardPropagation(self): + for traces in self.traces.values(): + for trace in traces.values(): + if trace.inhibitsClassScopeForwardPropagation(): + return True + + return False + def _updateVariablesFromCollectionFirst(new_collection): for variable, variable_traces in iterItems(new_collection.getVariableTracesAll()): diff --git a/nuitka/nodes/LocalsScopes.py b/nuitka/nodes/LocalsScopes.py index 7e6734338..b87dd5be2 100644 --- a/nuitka/nodes/LocalsScopes.py +++ b/nuitka/nodes/LocalsScopes.py @@ -246,6 +246,8 @@ class LocalsDictHandleBase(object): temp_type="object", ) + trace_collection.initVariableLate(self.propagation[variable_name]) + return self.propagation[variable_name] def getPropagationVariables(self): @@ -334,9 +336,8 @@ class LocalsDictHandle(LocalsDictHandleBase): return for variable in self.variables.values(): - for variable_trace in variable.traces: - if variable_trace.inhibitsClassScopeForwardPropagation(): - return + if variable.inhibitsClassScopeForwardPropagation(): + return trace_collection.signalChange( "var_usage",