Skip to content

Commit 392a37c

Browse files
refix {{ roundtrip, fix hasattr static check
1 parent 62f034d commit 392a37c

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
@@ -173,8 +173,9 @@ def p() -> AST:
173173
re.sub(r"#\s*mypy:\s*ignore(?![-_])", "# type: ignore", s)
174174
if t == tokenize.COMMENT
175175
else (
176-
s + "{"
176+
s[:-1]
177177
if is_defective_version
178+
and hasattr(tokenize, "FSTRING_MIDDLE") #technically redundant as all the defective versions have this, but we'd like to appease the typechecker here
178179
and t == tokenize.FSTRING_MIDDLE
179180
and s.startswith("\\")
180181
and s.endswith("{")

0 commit comments

Comments
 (0)