From 0c5e01a41d86ca30385622948252f350878921c1 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Thu, 12 Oct 2023 09:19:56 -0400 Subject: [PATCH] fix 3.12 false positive when fstring chunk is a keyword --- pycodestyle.py | 1 + testing/data/python36.py | 1 + 2 files changed, 2 insertions(+) diff --git a/pycodestyle.py b/pycodestyle.py index c492436b..18514f06 100755 --- a/pycodestyle.py +++ b/pycodestyle.py @@ -490,6 +490,7 @@ def missing_whitespace_after_keyword(logical_line, tokens): # appear e.g. as "if x is None:", and async/await, which were # valid identifier names in old Python versions. if (tok0.end == tok1.start and + tok0.type == tokenize.NAME and keyword.iskeyword(tok0.string) and tok0.string not in SINGLETONS and not (tok0.string == 'except' and tok1.string == '*') and diff --git a/testing/data/python36.py b/testing/data/python36.py index 94ec2dc5..aefd6540 100644 --- a/testing/data/python36.py +++ b/testing/data/python36.py @@ -1,2 +1,3 @@ #: Okay f'{hello}:{world}' +f'in{x}'