diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-04-13 11:07:24 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-04-13 11:07:24 (GMT) |
commit | 485fb56eb86a1fcd35fd3d0d37efb5ec514dba2b (patch) | |
tree | f6b23e9670e70af104a248010798942acdbc5c7b /Lib/pickletools.py | |
parent | 36067606707844f7de076cf1846afb767b494d7e (diff) | |
download | cpython-485fb56eb86a1fcd35fd3d0d37efb5ec514dba2b.zip cpython-485fb56eb86a1fcd35fd3d0d37efb5ec514dba2b.tar.gz cpython-485fb56eb86a1fcd35fd3d0d37efb5ec514dba2b.tar.bz2 |
Issue #8383: pickle and pickletools use surrogatepass error handler when
encoding unicode as utf8 to support lone surrogates and stay compatible with
Python 2.x and 3.0
Diffstat (limited to 'Lib/pickletools.py')
-rw-r--r-- | Lib/pickletools.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/pickletools.py b/Lib/pickletools.py index ca11aa3..6ab75c7 100644 --- a/Lib/pickletools.py +++ b/Lib/pickletools.py @@ -469,7 +469,7 @@ def read_unicodestring4(f): raise ValueError("unicodestring4 byte count < 0: %d" % n) data = f.read(n) if len(data) == n: - return str(data, 'utf-8') + return str(data, 'utf-8', 'surrogatepass') raise ValueError("expected %d bytes in a unicodestring4, but only %d " "remain" % (n, len(data))) |