Skip to content

Commit

Permalink
Add call to __str__() before concatenating strings in visit_JoinedStr
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrien Chauve committed Jan 1, 2017
1 parent 38f6a15 commit ba097e0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mypy/fastparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,8 @@ def visit_Str(self, n: ast35.Str) -> Union[UnicodeExpr, StrExpr]:
def visit_JoinedStr(self, n: ast35.JoinedStr) -> Expression:
result_expression = StrExpr('') # type: Expression
for value_expr in self.translate_expr_list(n.values):
result_expression = OpExpr('+', result_expression, value_expr)
stringified_value_expr = CallExpr(MemberExpr(value_expr, '__str__'), [], [])
result_expression = OpExpr('+', result_expression, stringified_value_expr)
return result_expression

# FormattedValue(expr value)
Expand Down

0 comments on commit ba097e0

Please sign in to comment.