summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-01-25 03:08:42 (GMT)
committerGitHub <noreply@github.com>2022-01-25 03:08:42 (GMT)
commitc314e3e829943b186e1c894071f00c613433cfe5 (patch)
tree4e8b197edae641028a96a8c19d82e927479ff752 /Lib
parent3f1ea163ea54513e00e0e9d5442fee1b639825cc (diff)
downloadcpython-c314e3e829943b186e1c894071f00c613433cfe5.zip
cpython-c314e3e829943b186e1c894071f00c613433cfe5.tar.gz
cpython-c314e3e829943b186e1c894071f00c613433cfe5.tar.bz2
bpo-46503: Prevent an assert from firing when parsing some invalid \N sequences in f-strings. (GH-30865) (30867)
* bpo-46503: Prevent an assert from firing. Also fix one nearby tiny PEP-7 nit. * Added blurb. (cherry picked from commit 0daf72194bd4e31de7f12020685bb39a14d6f45e) Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com> Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_fstring.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_fstring.py b/Lib/test/test_fstring.py
index 518ebdf..92a4d22 100644
--- a/Lib/test/test_fstring.py
+++ b/Lib/test/test_fstring.py
@@ -747,12 +747,16 @@ x = (
# differently inside f-strings.
self.assertAllRaise(SyntaxError, r"\(unicode error\) 'unicodeescape' codec can't decode bytes in position .*: malformed \\N character escape",
[r"f'\N'",
+ r"f'\N '",
+ r"f'\N '", # See bpo-46503.
r"f'\N{'",
r"f'\N{GREEK CAPITAL LETTER DELTA'",
# Here are the non-f-string versions,
# which should give the same errors.
r"'\N'",
+ r"'\N '",
+ r"'\N '",
r"'\N{'",
r"'\N{GREEK CAPITAL LETTER DELTA'",
])