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.
This commit is contained in:
parent
81098ac1c8
commit
ff57bff16e
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue