Skip to content

Commit 73b2700

Browse files
authored
Merge pull request PyCQA#1207 from PyCQA/fstring-keyword-part
fix 3.12 false positive when fstring chunk is a keyword
2 parents 8394fa2 + 0c5e01a commit 73b2700

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

‎pycodestyle.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,7 @@ def missing_whitespace_after_keyword(logical_line, tokens):
490490
# appear e.g. as "if x is None:", and async/await, which were
491491
# valid identifier names in old Python versions.
492492
if (tok0.end == tok1.start and
493+
tok0.type == tokenize.NAME and
493494
keyword.iskeyword(tok0.string) and
494495
tok0.string not in SINGLETONS and
495496
not (tok0.string == 'except' and tok1.string == '*') and

‎testing/data/python36.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
#: Okay
22
f'{hello}:{world}'
3+
f'in{x}'

0 commit comments

Comments
 (0)