[issue43946] unpickling a subclass of list fails when it implements its own extend method

2021-04-27 Thread Gregory P. Smith
Gregory P. Smith 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

[issue43946] unpickling a subclass of list fails when it implements its own extend method

2021-04-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: >From PEP 307: listitemsOptional, 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

[issue43946] unpickling a subclass of list fails when it implements its own extend method

2021-04-26 Thread Richard Levasseur
Richard Levasseur added the comment: Here's a self-contained repro: ``` import pickle class MyList(list): def __init__(self, required, values): self.required = required super().__init__(values) def __getstate__(self): return self.required def __setstate__(self, state):

[issue43946] unpickling a subclass of list fails when it implements its own extend method

2021-04-26 Thread Gregory P. Smith
New submission from Gregory P. Smith : The changes from https://bugs.python.org/issue29368 are causing a subclass of list trouble: ``` class FieldList(list): ... def extend(...): ... ``` FieldList has its own extend and append methods that implement additional checks. As it is a lis