File tree 1 file changed +4
-6
lines changed
1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ def assign2atoms(assign_ast, default_class=int):
91
91
prev_target_type = OrderedDict
92
92
elif isinstance (target , ast .Subscript ):
93
93
if isinstance (target .slice , ast .Constant ): # PY39
94
- index = target .slice .n
94
+ index = target .slice .value
95
95
else : # PY38
96
96
index = target .slice .value .n
97
97
atoms .append (Atom (target , prev_target_type , index ))
@@ -174,12 +174,10 @@ def obj_from_atoms(atoms, namespace):
174
174
175
175
def _get_value (assign ):
176
176
value = assign .value
177
- if isinstance (value , ast .Num ):
178
- return value .n
179
- if isinstance (value , ast .Str ):
180
- return value .s
177
+ if isinstance (value , ast .Constant ):
178
+ return value .value
181
179
if isinstance (value , ast .UnaryOp ) and isinstance (value .op , ast .USub ):
182
- return - value .operand .n
180
+ return - value .operand .value
183
181
raise AscconvParseError (f'Unexpected RHS of assignment: { value } ' )
184
182
185
183
You can’t perform that action at this time.
0 commit comments