Skip to content

Commit

Permalink
Fixed use of ast.Str.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexnick83 committed Oct 9, 2023
1 parent e553510 commit 5ae0b47
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dace/frontend/python/preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,8 @@ def visit_JoinedStr(self, node: ast.JoinedStr) -> Any:
parsed = [
not isinstance(v, ast.FormattedValue) or isinstance(v.value, ast.Constant) for v in visited.values
]
values = [v.s if isinstance(v, ast.Str) else astutils.unparse(v.value) for v in visited.values]
# NOTE: In Python < 3.8, v should be ast.Str. In Python 3.8 and later, it is (probably) ast.Constant.
values = [astutils.unparse(v.value) if sys.vesion_info >= (3, 8) else v.s for v in visited.values]
return ast.copy_location(
ast.Constant(kind='', value=''.join(('{%s}' % v) if not p else v for p, v in zip(parsed, values))),
node)
Expand Down

0 comments on commit 5ae0b47

Please sign in to comment.