Commit ff57bff1 authored by Tim Peters's avatar Tim Peters

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.
parent 81098ac1
...@@ -471,14 +471,17 @@ class Pickler: ...@@ -471,14 +471,17 @@ class Pickler:
if proto >= 2: if proto >= 2:
for element in object: for element in object:
save(element) save(element)
# Subtle. Same as in the big comment below # Subtle. Same as in the big comment below.
if id(object) in memo: if id(object) in memo:
get = self.get(memo[id(object)][0]) get = self.get(memo[id(object)][0])
write(POP_MARK + get) write(POP * n + get)
else: else:
write(_tuplesize2code[n]) write(_tuplesize2code[n])
self.memoize(object)
return return
# proto 0, or proto 1 and tuple isn't empty, or proto > 1 and tuple
# has more than 3 elements.
write(MARK) write(MARK)
for element in object: for element in object:
save(element) save(element)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment