summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-08-15 12:41:55 (GMT)
committerGitHub <noreply@github.com>2023-08-15 12:41:55 (GMT)
commitd189480942348aab345500ac9204965f67f30210 (patch)
tree9c3875ce2cec11e1eaaa98aa3c07be495f914de8 /Lib/test
parente8963a86ead0f5516948b3ad55b410b7fc5fb194 (diff)
downloadcpython-d189480942348aab345500ac9204965f67f30210.zip
cpython-d189480942348aab345500ac9204965f67f30210.tar.gz
cpython-d189480942348aab345500ac9204965f67f30210.tar.bz2
[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 d66bc9e8a7a8d6774d912a4b9d151885c4d8de1d) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_fstring.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_fstring.py b/Lib/test/test_fstring.py
index cb14bba..16f0197 100644
--- a/Lib/test/test_fstring.py
+++ b/Lib/test/test_fstring.py
@@ -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()