Message392100
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__. |
|
Date |
User |
Action |
Args |
2021-04-27 16:05:29 | gregory.p.smith | set | recipients:
+ gregory.p.smith, serhiy.storchaka, richardlev |
2021-04-27 16:05:29 | gregory.p.smith | set | messageid: <1619539529.53.0.106788815629.issue43946@roundup.psfhosted.org> |
2021-04-27 16:05:29 | gregory.p.smith | link | issue43946 messages |
2021-04-27 16:05:29 | gregory.p.smith | create | |
|