Merge pull request #776 from cmdicely/bugfix/775-power-puter-python-314-compatibility
Power Puter: Avoid relying on obsolete `ast.Num` after its removal
This commit is contained in:
+3
-2
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user