Skip to content

Commit 69b0ce7

Browse files
fix whitespace roundtripping?
1 parent 0bb0886 commit 69b0ce7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mypy/fastparse.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,15 @@ def p() -> AST:
175175
else (
176176
s[:-1]
177177
if is_defective_version
178-
and hasattr(
179-
tokenize, "FSTRING_MIDDLE"
180-
) # technically redundant as all the defective versions have this, but we'd like to appease the typechecker here
178+
# Technically redundant hasattr check as all the defective versions are versions that have this attribute, but we'd like to appease the typechecker here:
179+
and hasattr(tokenize, "FSTRING_MIDDLE")
181180
and t == tokenize.FSTRING_MIDDLE
182181
and s.startswith("\\")
183182
and s.endswith("{")
184183
else s
185184
)
186185
),
186+
*_ #this improves whitespace roundtripping (possibly always making it perfect, for this usecase?)
187187
)
188188
for t, s, *_ in tokens
189189
)

0 commit comments

Comments
 (0)