[Python-checkins] cpython: Issue #13916: Fix surrogatepass error handler on Windows

victor.stinner python-checkins at python.org
Fri May 16 14:48:59 CEST 2014


http://hg.python.org/cpython/rev/8ee2b73cda7a
changeset:   90725:8ee2b73cda7a
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Fri May 16 14:46:20 2014 +0200
summary:
  Issue #13916: Fix surrogatepass error handler on Windows

files:
  Lib/test/test_codecs.py |  6 ------
  Python/codecs.c         |  4 ++++
  2 files changed, 4 insertions(+), 6 deletions(-)


diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py
--- a/Lib/test/test_codecs.py
+++ b/Lib/test/test_codecs.py
@@ -2841,12 +2841,6 @@
             (b'abc', 'strict', 'abc'),
             (b'\xe9\x80', 'strict', '\xe9\u20ac'),
             (b'\xff', 'strict', '\xff'),
-            # invalid bytes
-            (b'[\x98]', 'strict', None),
-            (b'[\x98]', 'ignore', '[]'),
-            (b'[\x98]', 'replace', '[\ufffd]'),
-            (b'[\x98]', 'surrogateescape', '[\udc98]'),
-            (b'[\x98]', 'surrogatepass', None),
         ))
 
     def test_cp_utf7(self):
diff --git a/Python/codecs.c b/Python/codecs.c
--- a/Python/codecs.c
+++ b/Python/codecs.c
@@ -960,6 +960,10 @@
             }
         }
     }
+    else if (strcmp(encoding, "CP_UTF8") == 0) {
+        *bytelength = 3;
+        return ENC_UTF8;
+    }
     return ENC_UNKNOWN;
 }
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list