From 5f6f648636f2a8f78bf77908174d18e736114f32 Mon Sep 17 00:00:00 2001 From: mcDandy Date: Tue, 10 Feb 2026 17:08:06 +0100 Subject: [PATCH] stack is now partial execution safe --- more_math/AudioMathNode.py | 2 +- more_math/ClipMathNode.py | 1 + more_math/ConditioningMathNode.py | 1 + more_math/FloatMathNode.py | 1 + more_math/GuiderMathNode.py | 1 + more_math/ImageMathNode.py | 1 + more_math/LatentMathNode.py | 1 + more_math/MaskMathNode.py | 2 +- more_math/ModelMathNode.py | 2 ++ more_math/NoiseMathNode.py | 1 + more_math/SigmasMathNode.py | 2 +- more_math/VaeMathNode.py | 1 + more_math/VideoMathNode.py | 1 + 13 files changed, 14 insertions(+), 3 deletions(-) diff --git a/more_math/AudioMathNode.py b/more_math/AudioMathNode.py index 75bfffc..62f0023 100644 --- a/more_math/AudioMathNode.py +++ b/more_math/AudioMathNode.py @@ -91,7 +91,7 @@ class AudioMathNode(io.ComfyNode): tensor_keys = [k for k, v in V.items() if v is not None and isinstance(v, dict) and "waveform" in v] if not tensor_keys: raise ValueError("At least one audio input is required.") - + stack = stack.deepcopy() if stack is not None else {} waveforms = {k: V[k]["waveform"] for k in tensor_keys} sample_rates = {k + "sr": V[k].get("sample_rate", 44100) for k in tensor_keys} diff --git a/more_math/ClipMathNode.py b/more_math/ClipMathNode.py index eb6bc55..3847b9e 100644 --- a/more_math/ClipMathNode.py +++ b/more_math/ClipMathNode.py @@ -75,6 +75,7 @@ class CLIPMathNode(io.ComfyNode): def execute(cls, V, F, Expression, length_mismatch="tile",stack={}) -> io.NodeOutput: # Determine reference CLIP a = V.get("V0") + stack = stack.deepcopy() if stack is not None else {} if a is None: for m in V.values(): if m is not None: diff --git a/more_math/ConditioningMathNode.py b/more_math/ConditioningMathNode.py index dfde089..398fc6e 100644 --- a/more_math/ConditioningMathNode.py +++ b/more_math/ConditioningMathNode.py @@ -90,6 +90,7 @@ class ConditioningMathNode(io.ComfyNode): tensor_keys = [k for k, v in V.items() if v is not None and isinstance(v, list) and len(v) > 0] if not tensor_keys: raise ValueError("At least one input is required.") + stack = stack.deepcopy() if stack is not None else {} # Extract tensors and pooled outputs tensors = {} diff --git a/more_math/FloatMathNode.py b/more_math/FloatMathNode.py index bd3ea6c..1aa44bb 100644 --- a/more_math/FloatMathNode.py +++ b/more_math/FloatMathNode.py @@ -84,6 +84,7 @@ class FloatMathNode(io.ComfyNode): variables["x"] = V.get("V5", 0.0) variables["y"] = V.get("V6", 0.0) variables["z"] = V.get("V7", 0.0) + stack = stack.deepcopy() if stack is not None else {} # Populate all V inputs for k, val in V.items(): diff --git a/more_math/GuiderMathNode.py b/more_math/GuiderMathNode.py index eb1c129..86772e4 100644 --- a/more_math/GuiderMathNode.py +++ b/more_math/GuiderMathNode.py @@ -83,6 +83,7 @@ class GuiderMathNode(io.ComfyNode): @classmethod def execute(cls, V, F, Expression,Expression1,stack={}): + stack = stack.deepcopy() if stack is not None else {} return (MathGuider(V, F, Expression,Expression1),stack) diff --git a/more_math/ImageMathNode.py b/more_math/ImageMathNode.py index 2826936..d20ca0e 100644 --- a/more_math/ImageMathNode.py +++ b/more_math/ImageMathNode.py @@ -86,6 +86,7 @@ class ImageMathNode(io.ComfyNode): raise ValueError("At least one input is required.") tensors = [V[k] for k in tensor_keys] + stack = stack.deepcopy() if stack is not None else {} # Normalize all tensors together to find the common target shape normalized_tensors = normalize_to_common_shape(*tensors, mode=length_mismatch) diff --git a/more_math/LatentMathNode.py b/more_math/LatentMathNode.py index 6680387..7a70bd5 100644 --- a/more_math/LatentMathNode.py +++ b/more_math/LatentMathNode.py @@ -100,6 +100,7 @@ class LatentMathNode(io.ComfyNode): if ref_latent is None: raise ValueError("At least one input is required.") + stack = stack.deepcopy() if stack is not None else {} # Identify if any input is a NestedTensor and track original sizes for restoration stacked = False diff --git a/more_math/MaskMathNode.py b/more_math/MaskMathNode.py index 9422ca5..ccafb24 100644 --- a/more_math/MaskMathNode.py +++ b/more_math/MaskMathNode.py @@ -85,7 +85,7 @@ class MaskMathNode(io.ComfyNode): raise ValueError("At least one input is required.") tensors = [V[k] for k in tensor_keys] - + stack = stack.deepcopy() if stack is not None else {} # Normalize all tensors together normalized_tensors = normalize_to_common_shape(*tensors, mode=length_mismatch) V_norm = dict(zip(tensor_keys, normalized_tensors)) diff --git a/more_math/ModelMathNode.py b/more_math/ModelMathNode.py index a832a8e..1f937f2 100644 --- a/more_math/ModelMathNode.py +++ b/more_math/ModelMathNode.py @@ -76,6 +76,8 @@ class ModelMathNode(io.ComfyNode): def execute(cls, V, F, Expression, length_mismatch="tile",stack={}) -> io.NodeOutput: # Determine reference model for cloning a = V.get("V0") + stack = stack.deepcopy() if stack is not None else {} + if a is None: # Try finding first valid model for m in V.values(): diff --git a/more_math/NoiseMathNode.py b/more_math/NoiseMathNode.py index d2a5af1..a31c0f6 100644 --- a/more_math/NoiseMathNode.py +++ b/more_math/NoiseMathNode.py @@ -74,6 +74,7 @@ class NoiseMathNode(io.ComfyNode): @classmethod def execute(cls, Noise, V,F,stack={}): + stack = stack.deepcopy() if stack is not None else {} return (NoiseExecutor(V,F, Noise,stack),) diff --git a/more_math/SigmasMathNode.py b/more_math/SigmasMathNode.py index b6757d7..26c8b55 100644 --- a/more_math/SigmasMathNode.py +++ b/more_math/SigmasMathNode.py @@ -87,7 +87,7 @@ class SigmasMathNode(io.ComfyNode): if ref_image is None: raise ValueError("At least one input is required.") - + stack = stack.deepcopy() if stack is not None else {} a = V.get("V0") b = V.get("V1") c = V.get("V2") diff --git a/more_math/VaeMathNode.py b/more_math/VaeMathNode.py index f3fd41d..7617868 100644 --- a/more_math/VaeMathNode.py +++ b/more_math/VaeMathNode.py @@ -83,6 +83,7 @@ class VAEMathNode(io.ComfyNode): break if a is None: raise ValueError("At least one input VAE is required.") + stack = stack.deepcopy() if stack is not None else {} # Prepare VAE patchers for calculation diff --git a/more_math/VideoMathNode.py b/more_math/VideoMathNode.py index dd2858d..24bb685 100644 --- a/more_math/VideoMathNode.py +++ b/more_math/VideoMathNode.py @@ -95,6 +95,7 @@ class VideoMathNode(io.ComfyNode): # Use first normalized tensor to establish the reference shape ref_tensor = normalized_tensors[0] common_shape = ref_tensor.shape + stack = stack.deepcopy() if stack is not None else {} # Setup legacy variables a, b, c, d ae = V_norm.get("V0", make_zero_like(ref_tensor))