File tree Expand file tree Collapse file tree 1 file changed +2
-7
lines changed
Expand file tree Collapse file tree 1 file changed +2
-7
lines changed Original file line number Diff line number Diff line change 4242
4343_string_type_nodes = (ast .Str , ast .Bytes ) if py3 else (ast .Str ,)
4444_numeric_types = (int , float , complex ) + (() if py3 else (long ,))
45-
46- # added in Python 3.4
47- if hasattr (ast , "NameConstant" ):
48- _name_type_nodes = (ast .Name , ast .NameConstant )
49- else :
50- _name_type_nodes = (ast .Name ,)
45+ _name_type_nodes = (ast .Name , ast .NameConstant ) if py3 else (ast .Name ,)
5146
5247
5348class EvaluationError (Exception ):
@@ -98,7 +93,7 @@ def simple_eval(node_or_string, namespace=None):
9893 node_or_string = node_or_string .body
9994
10095 def _convert (node ):
101- if sys . version_info [: 2 ] >= ( 3 , 6 ) and isinstance (node , ast .Constant ):
96+ if py3 and isinstance (node , ast .Constant ):
10297 return node .value
10398 if isinstance (node , _string_type_nodes ):
10499 return node .s
You can’t perform that action at this time.
0 commit comments