From: Tim Peters Date: Tue, 28 Jan 2003 05:34:53 +0000 (+0000) Subject: save_tuple(): I believe the new code for TUPLE{1,2,3} in proto 2 was X-Git-Tag: v2.3c1~2243 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ff57bff16ef081c8d8140ee5d46af1416304d655;p=python 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. --- diff --git a/Lib/pickle.py b/Lib/pickle.py index 95bdd26913..6f4ee5c9ac 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)