1
mirror of https://github.com/comfyanonymous/ComfyUI.git synced 2025-08-03 07:26:31 +08:00

Removed state from ComfyNodeV3

This commit is contained in:
Jedrzej Kosinski
2025-07-19 20:45:54 -07:00
parent 96d317b3e2
commit a7c59dc3d6
2 changed files with 1 additions and 85 deletions

View File

@@ -18,11 +18,7 @@ class XYZ:
class V3TestNode(io.ComfyNodeV3):
class State(io.NodeState):
my_str: str
my_int: int
state: State
# NOTE: this is here just to test that state is not leaking
def __init__(self):
super().__init__()
self.hahajkunless = ";)"
@@ -84,23 +80,6 @@ class V3TestNode(io.ComfyNodeV3):
@classmethod
def execute(cls, image: io.Image.Type, some_int: int, combo: io.Combo.Type, combo2: io.MultiCombo.Type, xyz: XYZ.Type=None, mask: io.Mask.Type=None, **kwargs):
zzz = cls.hidden.prompt
cls.state.my_str = "LOLJK"
expected_int = 123
if "thing" not in cls.state:
cls.state["thing"] = "hahaha"
yyy = cls.state["thing"] # noqa
del cls.state["thing"]
if cls.state.get_value("int2") is None:
cls.state.set_value("int2", 123)
zzz = cls.state.get_value("int2") # noqa
cls.state.pop("int2")
if cls.state.my_int is None:
cls.state.my_int = expected_int
else:
if cls.state.my_int != expected_int:
raise Exception(f"Explicit state object did not maintain expected value (__getattr__/__setattr__): {cls.state.my_int} != {expected_int}")
#some_int
if hasattr(cls, "hahajkunless"):
raise Exception("The 'cls' variable leaked instance state between runs!")
if hasattr(cls, "doohickey"):