-
-
Notifications
You must be signed in to change notification settings - Fork 374
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
Support custom __getstate__, __setstate__ for slotted classes (or improve docs)? #512
Comments
You have opened this issue in the best possible moment because I'm prototyping a new API right now and this might go in. No promises about timeline and whether it'll be python2-compatible for now tho. |
Glad to hear! In the meantime, I made this suggestion: #513. I think it makes sense. Maybe I'm missing something, but isn't the docs (referenced above) misleading/inconsistent with current behaviour? |
Ok, read the docs more carefully and now understand that "You can support protocol 0 and 1 by implementing |
With that you're way ahead of me because I don't understand that paragraph at all anymore. 😅 It would be great if we could rewrite it once this has been resolved. |
The assertion fails in the following example, but is ok with
slots=False
:This is clearly because
attrs
auto creates these methods on the new slots-class: https://github.com/python-attrs/attrs/blob/master/src/attr/_make.py#L601Is there another prefered way to solve this, or would it be possible to support these methods also for slots-classes? If not, it would be good to clarify this in the documentation for slotted-classes, it says:
This is confusing to me, since implementing these methods have no effect for slotted classes?
Somewhat related:
#139
#475
The text was updated successfully, but these errors were encountered: