Skip to content

Commit 081c170

Browse files
authored
Merge pull request #1148 from PyCQA/fstring-312
add fix for muting FSTRING_MIDDLE in 3.12+
2 parents 91d1433 + 8493758 commit 081c170

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

pycodestyle.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2010,6 +2010,11 @@ def build_tokens_line(self):
20102010
continue
20112011
if token_type == tokenize.STRING:
20122012
text = mute_string(text)
2013+
elif (
2014+
sys.version_info >= (3, 12) and
2015+
token_type == tokenize.FSTRING_MIDDLE
2016+
):
2017+
text = 'x' * len(text)
20132018
if prev_row:
20142019
(start_row, start_col) = start
20152020
if prev_row != start_row: # different row

testsuite/python36.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#: Okay
2+
f'{hello}:{world}'

0 commit comments

Comments
 (0)