Skip to content

Commit 9a4d45c

Browse files
committed
PEP 498 f-strings support
PEP 498 f-strings cause pyflakes to crash with AttributeError: 'Checker' object has no attribute 'FORMATTEDVALUE'
1 parent 69a715d commit 9a4d45c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

pyflakes/checker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ def ignore(self, node):
675675
EQ = NOTEQ = LT = LTE = GT = GTE = IS = ISNOT = IN = NOTIN = ignore
676676

677677
# additional node types
678-
COMPREHENSION = KEYWORD = handleChildren
678+
COMPREHENSION = KEYWORD = FORMATTEDVALUE = handleChildren
679679

680680
def GLOBAL(self, node):
681681
"""

pyflakes/test/test_other.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,14 @@ def test_returnOnly(self):
989989
"""Do not crash on lone "return"."""
990990
self.flakes('return 2')
991991

992+
@skipIf(version_info < (3, 6), 'new in Python 3.6')
993+
def test_f_string(self):
994+
"""Test PEP 498 f-strings are treated as a usage."""
995+
self.flakes('''
996+
baz = 0
997+
print(f'\x7b4*baz\N{RIGHT CURLY BRACKET}')
998+
''')
999+
9921000

9931001
class TestAsyncStatements(TestCase):
9941002

0 commit comments

Comments
 (0)