-
Notifications
You must be signed in to change notification settings - Fork 176
Support for pickling functions within a class defined outside of __main__? #175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
functions and classes defined outside of functions and classes defined inside the If I understand correctly your issue, it seems that you would like to extend the serialization behavior of functions/classes defined in the |
I had to hack the same thing for our project. We had to add It would be nice to have the same functionality built-in. |
The tiny hack I did was just removing the modules from |
There are two more hacks, that are also very simple:
|
... still it would be nice to have the functionality in cloudpickle, to disable this check ... |
I think this was completed by #417? |
Cloudpickle's ability to serialize instantiated classes and their member functions is a huge advantage over cloudpickle alternatives. Unfortunately, this feature seems limited heavily to the check for
instantiated_class.__module__ == '__main__'
.One hacky solution is to set
__module__
in the class definition:But this could cause problems with any code that relies on a proper value for
__module__
. Is there another solution I'm not seeing?The text was updated successfully, but these errors were encountered: