From ff57bff16ef081c8d8140ee5d46af1416304d655 Mon Sep 17 00:00:00 2001 From: Tim Peters Date: Tue, 28 Jan 2003 05:34:53 +0000 Subject: [PATCH] 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. --- Lib/pickle.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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) -- 2.50.1