-
Notifications
You must be signed in to change notification settings - Fork 176
ENH pickle classes and objects with __slots__ #228
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
ENH pickle classes and objects with __slots__ #228
Conversation
Codecov Report
@@ Coverage Diff @@
## master #228 +/- ##
=========================================
+ Coverage 84.92% 85.1% +0.18%
=========================================
Files 1 1
Lines 577 584 +7
Branches 114 117 +3
=========================================
+ Hits 490 497 +7
Misses 63 63
Partials 24 24
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(not that my approval counts, but thank you for the quick fix!!)
@@ -1310,6 +1310,35 @@ def g(x): | |||
|
|||
self.assertEqual(f2.__annotations__, f.__annotations__) | |||
|
|||
def test_instance_with_slots(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lg2m, thank you so much for taking this on!
9bf7281
to
878f1f6
Compare
878f1f6
to
381e267
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, please add an entry to the change log (for 0.7).
I merged too quickly: we don't want to introduce a new dependency on six just for |
woops, didn't see |
closes #225
Note that this this implementation will fail if the class
__slots__
attribute is modified after the class creation.Choosing to handle this case would lead to complex and tedious code, and I am not even sure we can guess correctly the existence of slots in every single case.
In addition, choosing not to handle this is consistent with python's choice: stating the documetation of the stdlib's
copyreg._slotnames
function: