mirror of
https://github.com/python/cpython.git
synced 2025-10-31 21:51:50 +00:00
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 0daf72194b)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
This commit is contained in:
parent
3f1ea163ea
commit
c314e3e829
3 changed files with 19 additions and 2 deletions
|
|
@ -747,12 +747,16 @@ def test_misformed_unicode_character_name(self):
|
|||
# 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'",
|
||||
])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue