summaryrefslogtreecommitdiffstats
path: root/Lib/pickle.py
diff options
context:
space:
mode:
authorAlexandre Vassalotti <alexandre@peadrop.com>2013-04-20 20:19:46 (GMT)
committerAlexandre Vassalotti <alexandre@peadrop.com>2013-04-20 20:19:46 (GMT)
commit1f7492c28a5aa5a1abfb3de9dc88ac440296a36c (patch)
tree77a3d5d6c92344e1030c2cf30bc135d90aac60fc /Lib/pickle.py
parentbdf940d3bda45649c14d0cc6225880b7a8667fd4 (diff)
downloadcpython-1f7492c28a5aa5a1abfb3de9dc88ac440296a36c.zip
cpython-1f7492c28a5aa5a1abfb3de9dc88ac440296a36c.tar.gz
cpython-1f7492c28a5aa5a1abfb3de9dc88ac440296a36c.tar.bz2
Isuse #17720: Fix APPENDS handling in the Python implementation of Unpickler
to correctly process the opcode when it is used on non-list objects.
Diffstat (limited to 'Lib/pickle.py')
-rw-r--r--Lib/pickle.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/pickle.py b/Lib/pickle.py
index 161c2e9..1d8185c 100644
--- a/Lib/pickle.py
+++ b/Lib/pickle.py
@@ -1208,8 +1208,14 @@ class _Unpickler:
def load_appends(self):
stack = self.stack
mark = self.marker()
- list = stack[mark - 1]
- list.extend(stack[mark + 1:])
+ list_obj = stack[mark - 1]
+ items = stack[mark + 1:]
+ if isinstance(list_obj, list):
+ list_obj.extend(items)
+ else:
+ append = list_obj.append
+ for item in items:
+ append(item)
del stack[mark:]
dispatch[APPENDS[0]] = load_appends