Skip to content

Commit

Permalink
Unparsing constant.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexnick83 committed Oct 9, 2023
1 parent 650e386 commit 4cf6959
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dace/frontend/python/preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -873,8 +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
]
# NOTE: In Python < 3.8, v should be ast.Str. In Python 3.8 and later, it is (probably) ast.Constant.
values = [v.s if sys.version_info < (3, 8) and isinstance(v, ast.Str) else v.value for v in visited.values]
values = [v.s if sys.version_info < (3, 8) and isinstance(v, ast.Str) else astutils.unparse(v.value)
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 4cf6959

Please sign in to comment.