Gregory P. Smith <g...@krypto.org> added the comment:

Thanks, that makes sense.  And it at least less ugly than the __new__ hack I 
was thinking of as a workaround.  though similar in spirit.

presumably self.append should get the same treatment for completeness given the 
PEP 307 text.

I didn't notice a place in the Python pickle docs that mentioned this specific 
thing about listitems and the need for append/extend.  I didn't do a thorough 
read though, maybe I overlooked something?  If not, it'd be worth figuring out 
how to get this uninitialized class calling of append/extend/__setitem__ for 
list and dict objects detailed in the main docs rather than off in the PEP.

It's semi-mentioned 
https://docs.python.org/3/library/pickle.html#object.__reduce__ here which is 
what the PEP added I suppose, but given this code has no custom __reduce__, we 
need to explicitly mention that list and dict subclasses supporting 
pickling/copying may need to be prepared to handle this situation.  With a 
versionchanged:: 3.7 noting that it now always applies to list subclasses 
without their own __reduce__.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43946>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to