Skip to content

Commit 4847e27

Browse files
author
Adrien Chauve
committed
Add call to __str__() before concatenating strings in visit_JoinedStr
1 parent 8f17a4c commit 4847e27

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mypy/fastparse.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,8 @@ def visit_Str(self, n: ast35.Str) -> Union[UnicodeExpr, StrExpr]:
776776
def visit_JoinedStr(self, n: ast35.JoinedStr) -> Expression:
777777
result_expression = StrExpr('') # type: Expression
778778
for value_expr in self.translate_expr_list(n.values):
779-
result_expression = OpExpr('+', result_expression, value_expr)
779+
stringified_value_expr = CallExpr(MemberExpr(value_expr, '__str__'), [], [])
780+
result_expression = OpExpr('+', result_expression, stringified_value_expr)
780781
return result_expression
781782

782783
# FormattedValue(expr value)

0 commit comments

Comments
 (0)