mirror of
https://github.com/python/cpython.git
synced 2025-08-29 21:25:01 +00:00
gh-99891: Fix infinite recursion in the tokenizer when showing warnings (GH-99893)
Automerge-Triggered-By: GH:pablogsal
This commit is contained in:
parent
19c38801ba
commit
417206a05c
4 changed files with 24 additions and 0 deletions
|
@ -160,6 +160,18 @@ class MiscSourceEncodingTest(unittest.TestCase):
|
|||
finally:
|
||||
os.unlink(TESTFN)
|
||||
|
||||
def test_tokenizer_fstring_warning_in_first_line(self):
|
||||
source = "0b1and 2"
|
||||
with open(TESTFN, "w") as fd:
|
||||
fd.write("{}".format(source))
|
||||
try:
|
||||
retcode, stdout, stderr = script_helper.assert_python_ok(TESTFN)
|
||||
self.assertIn(b"SyntaxWarning: invalid binary litera", stderr)
|
||||
self.assertEqual(stderr.count(source.encode()), 1)
|
||||
finally:
|
||||
os.unlink(TESTFN)
|
||||
|
||||
|
||||
class AbstractSourceEncodingTest:
|
||||
|
||||
def test_default_coding(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue