-
Notifications
You must be signed in to change notification settings - Fork 784
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
Generated classes are part of the builtin module #474
Comments
This was changed in c71c116#diff-d3dec314b1956210565bd5849a91e770. I don't see a problem in setting the module to the first one which initializes the class. This seems analogous to when I import a class in Python, then its @konstin How about we revert to the old behavior? @rth It might be possible to subclass in Python and set |
Thanks @Alexander-N ! You are right that works, but I'm hoping for some alternative solution that wouldn't require subclassing every single pyo3 generated class. |
I'm fine with reverting to the old behaviour if that unbreaks pickle, however we should document in the guide that module name depends on where the class was first used. Ideally we should also add an option to set the module manually, but that's independent of the default. |
Related to the pickle support #100 , as mentioned by @althonos ,
This is also discussed in the following test,
pyo3/tests/test_class_basics.rs
Lines 70 to 73 in 9f2afbc
Once
__module__
it is set tobuiltin
, it cannot be changed in an obvious way (at least I have not found one). Using the example class,it would be nice if there way some way to manually set the module name.
Also setuptools-rust does have the module name provided by the user for each
RustExtension
, but doesn't seem to be assigning it?The text was updated successfully, but these errors were encountered: