summaryrefslogtreecommitdiffstats
path: root/Lib/pickle.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2003-01-28 05:34:53 (GMT)
committerTim Peters <tim.peters@gmail.com>2003-01-28 05:34:53 (GMT)
commitff57bff16ef081c8d8140ee5d46af1416304d655 (patch)
tree5120d0c7b176feb0e91108da6a359a6ce018d240 /Lib/pickle.py
parent81098ac1c8c88f9f1dcf7511555d2ad1f7124575 (diff)
downloadcpython-ff57bff16ef081c8d8140ee5d46af1416304d655.zip
cpython-ff57bff16ef081c8d8140ee5d46af1416304d655.tar.gz
cpython-ff57bff16ef081c8d8140ee5d46af1416304d655.tar.bz2
save_tuple(): I believe the new code for TUPLE{1,2,3} in proto 2 was
incorrect for recursive tuples. Tried to repair; seems to work OK, but there are no checked-in tests for this yet.
Diffstat (limited to 'Lib/pickle.py')
-rw-r--r--Lib/pickle.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/pickle.py b/Lib/pickle.py
index 95bdd26..6f4ee5c 100644
--- a/Lib/pickle.py
+++ b/Lib/pickle.py
@@ -471,14 +471,17 @@ class Pickler:
if proto >= 2:
for element in object:
save(element)
- # Subtle. Same as in the big comment below
+ # Subtle. Same as in the big comment below.
if id(object) in memo:
get = self.get(memo[id(object)][0])
- write(POP_MARK + get)
+ write(POP * n + get)
else:
write(_tuplesize2code[n])
+ self.memoize(object)
return
+ # proto 0, or proto 1 and tuple isn't empty, or proto > 1 and tuple
+ # has more than 3 elements.
write(MARK)
for element in object:
save(element)