Skip to content

Commit e5a022f

Browse files
committed
PY39: Changes in ast parsing of indices
1 parent bc1c2ae commit e5a022f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

nibabel/nicom/ascconv.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ def assign2atoms(assign_ast, default_class=int):
8989
target = target.value
9090
prev_target_type = OrderedDict
9191
elif isinstance(target, ast.Subscript):
92-
index = target.slice.value.n
92+
if isinstance(target.slice, ast.Constant): # PY39
93+
index = target.slice.n
94+
else: # PY38
95+
index = target.slice.value.n
9396
atoms.append(Atom(target, prev_target_type, index))
9497
target = target.value
9598
prev_target_type = list

0 commit comments

Comments
 (0)