]> granicus.if.org Git - python/commit
Minimal fix for the complaints about pickling Unicode objects. (SF
authorGuido van Rossum <guido@python.org>
Tue, 19 Dec 2000 01:29:00 +0000 (01:29 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 19 Dec 2000 01:29:00 +0000 (01:29 +0000)
commita31b4ef7c526b7f17620024248d11a631ef59644
treef2220ffd26502e5ff5dc2ab0ef2c6d68487a27a6
parent20d3fc071bb16bb63333de4bb4d66fd0e7f68b64
Minimal fix for the complaints about pickling Unicode objects.  (SF
bugs #126161 and 123634).

The solution doesn't use the unicode-escape encoding; that has other
problems (it seems not 100% reversible).  Rather, it transforms the
input Unicode object slightly before encoding it using
raw-unicode-escape, so that the decoding will reconstruct the original
string: backslash and newline characters are translated into their
\uXXXX counterparts.

This is backwards incompatible for strings containing backslashes, but
for some of those strings, the pickling was already broken.
Lib/pickle.py