Traceback (most recent call last):
File "<python-input-0>", line 4, in <module>
pickle.dumps(s)
~~~~~~~~~~~~^^^_pickle.PicklingError: first argument to __newobj__() must be <class 'super'>, not <class '__main__.X'>
when serializing super object
This is because the special methods like __reduce_ex__() are looked up in an instance and translated to a lookup in the underlying object.
This cannot be solved by implementing the __reduce_ex__() method in the super class, because the current behavior is expected when super() is used in the __reduce_ex__() implementation of some subclass. The super class likely should be registered in the global dispatch table.
There may be similar issue with shallow and deep copying.
Activity
pythongh-125767: Fix pickling and copying
pythongh-125767: Fix pickling and copying of super objects
gh-125767: Fix pickling and copying of super objects (GH-125781)
pythongh-125767: Fix pickling and copying of super objects (pythonGH-…