Skip to content

Commit

Permalink
Check for ast.Num predicated by Python < 3.8.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexnick83 committed Oct 8, 2023
1 parent b302ec5 commit fa1d5c7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion dace/codegen/cppunparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,9 @@ def _Attribute(self, t):
# Special case: 3.__abs__() is a syntax error, so if t.value
# is an integer literal then we need to either parenthesize
# it or add an extra space to get 3 .__abs__().
if (isinstance(t.value, (ast.Num, ast.Constant)) and isinstance(t.value.n, int)):
if isinstance(t.value, ast.Constant) and isinstance(t.value.value, int):
self.write(" ")
elif sys.version_info < (3, 8) and isinstance(t.value, ast.Num) and isinstance(t.value.n, int):
self.write(" ")
if (isinstance(t.value, ast.Name) and t.value.id in ('dace', 'dace::math', 'dace::cmath')):
self.write("::")
Expand Down

0 comments on commit fa1d5c7

Please sign in to comment.