You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have a base class that defines __init_subclass__ with an argument, unpickling a child class will fail because cloudpickle does not pass along the original kwarg when re-creating the class.
This case seems to work fine in the built-in pickle package.
This usage mirrors examples shown in the docs and the original PEP that introduced the __init_subclass__ method.
Python 3.11.4
cloudpickle 2.2.1 EDIT: This also appears to be broken with cloudpickle 3.0.0.
Feel free to investigate yourself and submit a PR.
EDIT: maybe cloudpickle.cloudpickle._class_getnewargs should be made aware of what is returned by obj.__getnewargs_ex__ if this method is defined on the class instance to pickle. However I don't see how that could help pickling a class definition passed to cloudpickle.dumps without passing an instance. It seems that __getnewargs_ex__ is not meant to be a classmethod.
If you have a base class that defines
__init_subclass__
with an argument, unpickling a child class will fail becausecloudpickle
does not pass along the original kwarg when re-creating the class.This case seems to work fine in the built-in
pickle
package.This usage mirrors examples shown in the docs and the original PEP that introduced the
__init_subclass__
method.Python 3.11.4
cloudpickle 2.2.1
EDIT: This also appears to be broken with cloudpickle 3.0.0.
Example:
The text was updated successfully, but these errors were encountered: