Skip to content

Commit

Permalink
Reworked access to slice attribute.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexnick83 committed Oct 8, 2023
1 parent d8efaca commit f4cb38a
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions dace/frontend/python/astutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,12 @@ def subscript_to_ast_slice(node, without_array=False):

# Python <3.9 compatibility
result_slice = None
if sys.version_info < (3, 9):
if isinstance(node.slice, ast.Index):
slc = node.slice.value
if not isinstance(slc, ast.Tuple):
result_slice = [slc]
elif isinstance(node.slice, ast.ExtSlice):
slc = tuple(node.slice.dims)
else:
raise TypeError('Unsupported slicing type: ' + str(type(node.slice)))
if sys.version_info < (3, 9) and isinstance(node.slice, ast.Index):
slc = node.slice.value
if not isinstance(slc, ast.Tuple):
result_slice = [slc]
elif sys.version_info < (3, 9) and isinstance(node.slice, ast.ExtSlice):
slc = tuple(node.slice.dims)
else:
slc = node.slice

Expand Down

0 comments on commit f4cb38a

Please sign in to comment.