Skip to content

Commit 9b98967

Browse files
committed
Don't hoist 'literals' that are part of f-strings
1 parent ae88a30 commit 9b98967

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/python_minifier/rename/rename_literals.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,13 @@ def visit_JoinedStr(self, node):
220220
continue
221221
self.visit(v)
222222

223+
def visit_TemplateStr(self, node):
224+
for v in node.values:
225+
if is_constant_node(v, ast.Str):
226+
# Can't hoist string literals that are part of the template
227+
continue
228+
self.visit(v)
229+
223230
def visit_NameConstant(self, node):
224231
self.get_binding(node.value, node).add_reference(node)
225232

0 commit comments

Comments
 (0)