diff --git a/py/power_puter.py b/py/power_puter.py index db73f7a..8ff4294 100644 --- a/py/power_puter.py +++ b/py/power_puter.py @@ -30,6 +30,7 @@ from .power_lora_loader import RgthreePowerLoraLoader from nodes import ImageBatch from comfy_extras.nodes_latent import LatentBatch +AstNumConstantClasses = (ast.Num, ast.Constant) if hasattr(ast, "Num") else (ast.Constant) class LoopBreak(Exception): """A special error type that is caught in a loop for correct breaking behavior.""" @@ -523,8 +524,8 @@ class _Puter: if isinstance(stmt, (ast.FormattedValue, ast.Expr)): return self._eval_statement(stmt.value, ctx=ctx) - if isinstance(stmt, (ast.Constant, ast.Num)): - return stmt.n + if isinstance(stmt, AstNumConstantClasses): + return stmt.n if hasattr(stmt, "n") else stmt.value if isinstance(stmt, ast.BinOp): left = self._eval_statement(stmt.left, ctx=ctx)