[New-bugs-announce] [issue17720] pickle.py's load_appends should call append() on objects other than lists

Alexandre Vassalotti report at bugs.python.org
Sat Apr 13 20:04:49 CEST 2013


New submission from Alexandre Vassalotti:

In pickle.py, load_appends is currently defined as

    def load_appends(self):
        stack = self.stack
        mark = self.marker()
        list = stack[mark - 1]
        list.extend(stack[mark + 1:])
        del stack[mark:]

However, according to the spec of APPENDS, it should actually be:

    def load_appends(self):
        obj = stack[mark - 1]
        items = stack[mark + 1:]
        if isinstance(obj, list):
            obj.extend(items)
        else:
            for item in items:
                obj.append(item)

This will match with the current behaviour of _pickle.

----------
assignee: alexandre.vassalotti
components: Library (Lib)
files: loads_appends.patch
keywords: patch
messages: 186774
nosy: alexandre.vassalotti, pitrou, serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: pickle.py's load_appends should call append() on objects other than lists
type: behavior
versions: Python 3.3, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file29810/loads_appends.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17720>
_______________________________________


More information about the New-bugs-announce mailing list