Skip to content

Commit 31e0252

Browse files
author
Adrien Chauve
committed
Fix to support older versions of typed_ast
1 parent fc03182 commit 31e0252

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

mypy/fastparse.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -769,10 +769,12 @@ def visit_Str(self, n: ast35.Str) -> Union[UnicodeExpr, StrExpr]:
769769
else:
770770
return UnicodeExpr(n.s)
771771

772-
# JoinedStr(expr* values)
773-
@with_line
774-
def visit_JoinedStr(self, n: ast35.JoinedStr) -> StrExpr:
775-
return StrExpr(n.values[0])
772+
# Only available with typed_ast >= 0.6.2
773+
if hasattr(ast35, 'JoinedStr'):
774+
# JoinedStr(expr* values)
775+
@with_line
776+
def visit_JoinedStr(self, n: ast35.JoinedStr) -> StrExpr:
777+
return StrExpr(n.values[0])
776778

777779
# Bytes(bytes s)
778780
@with_line

0 commit comments

Comments
 (0)