diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2002-03-21 08:55:28 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2002-03-21 08:55:28 (GMT) |
commit | 047c05ebc4ce00f9ca8ccc5b8df437d758d130e8 (patch) | |
tree | 6dfd9cb0d3d345b89a8d5917f787490b79627798 /Lib | |
parent | bdf1f19feeda0953d30447d7ee4adbbf78a89d8b (diff) | |
download | cpython-047c05ebc4ce00f9ca8ccc5b8df437d758d130e8.zip cpython-047c05ebc4ce00f9ca8ccc5b8df437d758d130e8.tar.gz cpython-047c05ebc4ce00f9ca8ccc5b8df437d758d130e8.tar.bz2 |
Do not insert characters for unicode-escape decoders if the error mode
is "ignore". Fixes #529104.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_unicode.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index 56f1811..ad47f31 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -541,6 +541,14 @@ else: verify(unicode('Andr\202 x','ascii','ignore') == u"Andr x") verify(unicode('Andr\202 x','ascii','replace') == u'Andr\uFFFD x') +verify("\\N{foo}xx".decode("unicode-escape", "ignore") == u"xx") +try: + "\\".decode("unicode-escape") +except ValueError: + pass +else: + raise TestFailed, '"\\".decode("unicode-escape") should fail' + verify(u'hello'.encode('ascii') == 'hello') verify(u'hello'.encode('utf-7') == 'hello') verify(u'hello'.encode('utf-8') == 'hello') |