This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients alexandre.vassalotti, serhiy.storchaka
Date 2017-01-25.09:55:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1485338150.33.0.560817507263.issue29368@psf.upfronthosting.co.za>
In-reply-to
Content
According to PEP 307 the extend method can be used for appending list items to the object.

    listitems    Optional, and new in this PEP.
                 If this is not None, it should be an iterator (not a
                 sequence!) yielding successive list items.  These list
                 items will be pickled, and appended to the object using
                 either obj.append(item) or obj.extend(list_of_items).
                 This is primarily used for list subclasses, but may
                 be used by other classes as long as they have append()
                 and extend() methods with the appropriate signature.
                 (Whether append() or extend() is used depends on which
                 pickle protocol version is used as well as the number
                 of items to append, so both must be supported.)

Proposed patch makes the extend method be used in the APPENDS opcode. To avoid breaking existing code the use of the extend method is optional.

Microbenchmark:

$ ./python -m timeit -s "import pickle, collections; p = pickle.dumps(collections.deque([None]*10000), 4)" -- "pickle.loads(p)"
Unpatched:  100 loops, best of 5: 2.02 msec per loop
Patched:    500 loops, best of 5: 833 usec per loop
History
Date User Action Args
2017-01-25 09:55:50serhiy.storchakasetrecipients: + serhiy.storchaka, alexandre.vassalotti
2017-01-25 09:55:50serhiy.storchakasetmessageid: <1485338150.33.0.560817507263.issue29368@psf.upfronthosting.co.za>
2017-01-25 09:55:50serhiy.storchakalinkissue29368 messages
2017-01-25 09:55:49serhiy.storchakacreate