summaryrefslogtreecommitdiffstats
path: root/Lib/pickle.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2003-01-29 20:14:23 (GMT)
committerGuido van Rossum <guido@python.org>2003-01-29 20:14:23 (GMT)
commitba884f3d221d7c8a74ca8a6799214b692a6135f5 (patch)
tree118642b3260e24bcc95ab56262177f42321b472c /Lib/pickle.py
parentc1c2b3e0e2af6eb05346b4908f4c4d56618fb7b6 (diff)
downloadcpython-ba884f3d221d7c8a74ca8a6799214b692a6135f5.zip
cpython-ba884f3d221d7c8a74ca8a6799214b692a6135f5.tar.gz
cpython-ba884f3d221d7c8a74ca8a6799214b692a6135f5.tar.bz2
Use %c rather than chr() to turn some ints into chars.
Diffstat (limited to 'Lib/pickle.py')
-rw-r--r--Lib/pickle.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/pickle.py b/Lib/pickle.py
index 739c24f..9630d33 100644
--- a/Lib/pickle.py
+++ b/Lib/pickle.py
@@ -475,7 +475,7 @@ class Pickler:
self.write(BININT1 + chr(obj))
return
if obj <= 0xffff:
- self.write(BININT2 + chr(obj&0xff) + chr(obj>>8))
+ self.write("%c%c%c" % (BININT2, obj&0xff, obj>>8))
return
# Next check for 4-byte signed ints:
high_bits = obj >> 31 # note that Python shift sign-extends
@@ -747,7 +747,7 @@ class Pickler:
if code <= 0xff:
write(EXT1 + chr(code))
elif code <= 0xffff:
- write(EXT2 + chr(code&0xff) + chr(code>>8))
+ write("%c%c%c" % (EXT2, code&0xff, code>>8))
else:
write(EXT4 + pack("<i", code))
return