cpython: ff1366ff2761 (original) (raw)
--- a/Lib/test/test_codecs.py +++ b/Lib/test/test_codecs.py @@ -690,9 +690,9 @@ class UTF7Test(ReadTest): def test_errors(self): tests = [
('\xffb', u'\ufffdb'),[](#l1.7)
('a\xffb', u'a\ufffdb'),[](#l1.8)
('a\xff\xffb', u'a\ufffd\ufffdb'),[](#l1.9)
('\xe1b', u'\ufffdb'),[](#l1.10)
('a\xe1b', u'a\ufffdb'),[](#l1.11)
('a\xe1\xe1b', u'a\ufffd\ufffdb'),[](#l1.12) ('a+IK', u'a\ufffd'),[](#l1.13) ('a+IK-b', u'a\ufffdb'),[](#l1.14) ('a+IK,b', u'a\ufffdb'),[](#l1.15)
@@ -708,8 +708,8 @@ class UTF7Test(ReadTest): ('a+//,+IKw-b', u'a\ufffd\u20acb'), ('a+///,+IKw-b', u'a\uffff\ufffd\u20acb'), ('a+////,+IKw-b', u'a\uffff\ufffd\u20acb'),
('a+IKw-b\xff', u'a\u20acb\ufffd'),[](#l1.20)
('a+IKw\xffb', u'a\u20ac\ufffdb'),[](#l1.21)
('a+IKw-b\xe1', u'a\u20acb\ufffd'),[](#l1.22)
('a+IKw\xe1b', u'a\u20ac\ufffdb'),[](#l1.23) ][](#l1.24) for raw, expected in tests:[](#l1.25) try:[](#l1.26)
@@ -738,16 +738,16 @@ class UTF7Test(ReadTest): def test_lone_surrogates(self): tests = [ ('a+2AE-b', u'a\ud801b'),
('a+2AE\xffb', u'a\ufffdb'),[](#l1.31)
('a+2AE\xe1b', u'a\ufffdb'),[](#l1.32) ('a+2AE', u'a\ufffd'),[](#l1.33) ('a+2AEA-b', u'a\ufffdb'),[](#l1.34) ('a+2AH-b', u'a\ufffdb'),[](#l1.35) ('a+IKzYAQ-b', u'a\u20ac\ud801b'),[](#l1.36)
('a+IKzYAQ\xffb', u'a\u20ac\ufffdb'),[](#l1.37)
('a+IKzYAQ\xe1b', u'a\u20ac\ufffdb'),[](#l1.38) ('a+IKzYAQA-b', u'a\u20ac\ufffdb'),[](#l1.39) ('a+IKzYAd-b', u'a\u20ac\ufffdb'),[](#l1.40) ('a+IKwgrNgB-b', u'a\u20ac\u20ac\ud801b'),[](#l1.41)
('a+IKwgrNgB\xffb', u'a\u20ac\u20ac\ufffdb'),[](#l1.42)
('a+IKwgrNgB\xe1b', u'a\u20ac\u20ac\ufffdb'),[](#l1.43) ('a+IKwgrNgB', u'a\u20ac\u20ac\ufffd'),[](#l1.44) ('a+IKwgrNgBA-b', u'a\u20ac\u20ac\ufffdb'),[](#l1.45) ][](#l1.46)
--- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -1555,7 +1555,10 @@ int unicode_decode_call_errorhandler(con /* Is c a base-64 character? */ #define IS_BASE64(c) [](#l2.6)
- (((c) >= 'A' && (c) <= 'Z') || [](#l2.8)
((c) >= 'a' && (c) <= 'z') || \[](#l2.9)
((c) >= '0' && (c) <= '9') || \[](#l2.10)
(c) == '+' || (c) == '/')[](#l2.11)
/* given that c is a base-64 character, what is its base-64 value? */