Closed FlorianDeconinck closed 5 months ago
First evaluation:
I checked the code snippet above with both Python versions, and the issue at a superficial level is the following. In Python 3.8, the ast.Slice
of an ast.Subscript
does not contain line and column number information. In Python 3.11, the ast.Slice
has all the information. Due to the missing numbers in Python 3.8, parsing follows a different path, which doesn't crash.
Information for further debugging (@tbennun maybe you have an insight on this?):
Place a breakpoint at dace/frontent/python/preprocessing
line 750:
try:
gslice = astutils.evalnode(node.slice, self.globals)
except SyntaxError:
return self.generic_visit(node)
I haven't dug in this code so much, but it seem to me something changed to _visit_potential_constant
which made the calling code non-relevant anymore for list
.
Indeed in 3.8 it all failed so the return is just the same node.
I pushed a PR that, restrict the list to the slice then try to turn elements into constant, then return the corrected list. Works for my use case.
Describe the bug The interaction of python
3.11.7
andenumerate
+subscript
is breaking the parsing. The following code is a reduction of a code in NASA/NOAA dynamical core. This works with python3.8.X
To Reproduce
With python-3.11.7:
Traceback: