diff --git a/dace/frontend/python/astutils.py b/dace/frontend/python/astutils.py index ff2d191752..49d7278462 100644 --- a/dace/frontend/python/astutils.py +++ b/dace/frontend/python/astutils.py @@ -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