mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
[3.12] gh-107967: Fix infinite recursion on invalid escape sequence warning (GH-107968) (#107970)
gh-107967: Fix infinite recursion on invalid escape sequence warning (GH-107968)
(cherry picked from commit d66bc9e8a7
)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
This commit is contained in:
parent
e8963a86ea
commit
d189480942
2 changed files with 13 additions and 0 deletions
|
@ -1673,5 +1673,15 @@ print(f'''{{
|
|||
self.assertEqual(stdout.decode('utf-8').strip().replace('\r\n', '\n').replace('\r', '\n'),
|
||||
"3\n=3")
|
||||
|
||||
def test_syntax_warning_infinite_recursion_in_file(self):
|
||||
with temp_cwd():
|
||||
script = 'script.py'
|
||||
with open(script, 'w') as f:
|
||||
f.write(r"print(f'\{1}')")
|
||||
|
||||
_, stdout, stderr = assert_python_ok(script)
|
||||
self.assertIn(rb'\1', stdout)
|
||||
self.assertEqual(len(stderr.strip().splitlines()), 2)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue