File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -839,16 +839,16 @@ def eval_math(self, node):
839839 others will generate integers (if the inputs are integers).
840840 """
841841 try :
842- if isinstance (node , ast .Num ):
843- return self ._ast_num (node )
844- elif isinstance (node , ast .Constant ):
842+ if hasattr (ast , "Constant" ) and isinstance (node , ast .Constant ):
845843 return self ._ast_constant (node )
844+ elif hasattr (ast , "Num" ) and isinstance (node , ast .Num ): # Deprecated, removed in 3.14
845+ return self ._ast_num (node )
846846 elif isinstance (node , ast .Name ):
847847 return self ._ast_name (node )
848848 # TODO: Remove when we drop support for 3.6
849849 # DEPRECATED: Remove due to python 3.8
850850 # See: https://docs.python.org/3/library/ast.html#node-classes
851- elif isinstance (node , ast .Str ):
851+ elif hasattr ( ast , "Str" ) and isinstance (node , ast .Str ): # Deprecated, removed in 3.14
852852 return node .s
853853 elif isinstance (node , ast .Attribute ):
854854 return self ._ast_attr (node )
You can’t perform that action at this time.
0 commit comments