diff options
author | Eric V. Smith <ericvsmith@users.noreply.github.com> | 2022-01-25 02:53:27 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-25 02:53:27 (GMT) |
commit | 0daf72194bd4e31de7f12020685bb39a14d6f45e (patch) | |
tree | 829de3225fde1183fd0ad337af070361daa316e6 /Lib/test | |
parent | 7c26472d09548905d8c158b26b6a2b12de6cdc32 (diff) | |
download | cpython-0daf72194bd4e31de7f12020685bb39a14d6f45e.zip cpython-0daf72194bd4e31de7f12020685bb39a14d6f45e.tar.gz cpython-0daf72194bd4e31de7f12020685bb39a14d6f45e.tar.bz2 |
bpo-46503: Prevent an assert from firing when parsing some invalid \N sequences in f-strings. (GH-30865)
* bpo-46503: Prevent an assert from firing. Also fix one nearby tiny PEP-7 nit.
* Added blurb.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_fstring.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_fstring.py b/Lib/test/test_fstring.py index bd1ca94..d0b1ade 100644 --- a/Lib/test/test_fstring.py +++ b/Lib/test/test_fstring.py @@ -746,12 +746,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'", ]) |