diff options
author | Guido van Rossum <guido@python.org> | 2007-05-02 19:09:54 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-05-02 19:09:54 (GMT) |
commit | ef87d6ed94780fe00250a551031023aeb2898365 (patch) | |
tree | 1f8989aaaec7ec5f8b2f26498317f2022bf85531 /Lib/pickle.py | |
parent | 572dbf8f1320c0b34b9c786e5c30ba4a4b61b292 (diff) | |
download | cpython-ef87d6ed94780fe00250a551031023aeb2898365.zip cpython-ef87d6ed94780fe00250a551031023aeb2898365.tar.gz cpython-ef87d6ed94780fe00250a551031023aeb2898365.tar.bz2 |
Rip out all the u"..." literals and calls to unicode().
Diffstat (limited to 'Lib/pickle.py')
-rw-r--r-- | Lib/pickle.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Lib/pickle.py b/Lib/pickle.py index 2b01b02..26b2b8c 100644 --- a/Lib/pickle.py +++ b/Lib/pickle.py @@ -523,22 +523,22 @@ class Pickler: if StringType == UnicodeType: # This is true for Jython def save_string(self, obj, pack=struct.pack): - unicode = obj.isunicode() + str = obj.isunicode() if self.bin: - if unicode: + if str: obj = obj.encode("utf-8") l = len(obj) - if l < 256 and not unicode: + if l < 256 and not str: self.write(SHORT_BINSTRING + chr(l) + obj) else: s = pack("<i", l) - if unicode: + if str: self.write(BINUNICODE + s + obj) else: self.write(BINSTRING + s + obj) else: - if unicode: + if str: obj = obj.replace("\\", "\\u005c") obj = obj.replace("\n", "\\u000a") obj = obj.encode('raw-unicode-escape') @@ -956,12 +956,12 @@ class Unpickler: dispatch[BINSTRING] = load_binstring def load_unicode(self): - self.append(unicode(self.readline()[:-1],'raw-unicode-escape')) + self.append(str(self.readline()[:-1],'raw-unicode-escape')) dispatch[UNICODE] = load_unicode def load_binunicode(self): len = mloads('i' + self.read(4)) - self.append(unicode(self.read(len),'utf-8')) + self.append(str(self.read(len),'utf-8')) dispatch[BINUNICODE] = load_binunicode def load_short_binstring(self): |