-
Notifications
You must be signed in to change notification settings - Fork 167
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
pass the __dict__ item of a class __dict__ #291
base: master
Are you sure you want to change the base?
pass the __dict__ item of a class __dict__ #291
Conversation
ca0c8c8
to
cdd0aa7
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.
Once rebased on top of #290, please run the downstream ci tests.
Arg, this code is not safe with regards to reference cycles when |
Codecov Report
@@ Coverage Diff @@
## master #291 +/- ##
===========================================
- Coverage 92.84% 55.83% -37.01%
===========================================
Files 2 2
Lines 852 849 -3
Branches 177 176 -1
===========================================
- Hits 791 474 -317
- Misses 37 347 +310
- Partials 24 28 +4
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #291 +/- ##
==========================================
+ Coverage 92.84% 93.07% +0.23%
==========================================
Files 2 2
Lines 852 852
Branches 177 177
==========================================
+ Hits 791 793 +2
+ Misses 37 36 -1
+ Partials 24 23 -1
Continue to review full report at Codecov.
|
Some updates: now that The guard if not isinstance(obj, types.GetSetDescriptorType) and getattr(__dict__, '__objclass__', None), is not obj serves the purpose of finding this default case. Also, now that we special-case the situation where |
Codecov Report
@@ Coverage Diff @@
## master #291 +/- ##
==========================================
+ Coverage 92.84% 93.07% +0.23%
==========================================
Files 2 2
Lines 852 852
Branches 177 177
==========================================
+ Hits 791 793 +2
+ Misses 37 36 -1
+ Partials 24 23 -1
Continue to review full report at Codecov.
|
The failure of |
In from collections import namedtuple
namedtuple_class = namedtuple('MyTuple', ['a', 'b', 'c']) is overriden so that instances of these classes: t = namedtuple_class('foo', 'bar', 'qux') have their >>> t.__dict__
OrderedDict([('a', 'foo'), ('b', 'bar'), ('c', 'qux')])
>>> type(namedtuple.__dict__['__dict__'])
property (corresponding line in Visibly, cloudpickle was aware of that use case cloudpickle/cloudpickle/cloudpickle.py Lines 645 to 649 in 2db58f1
It turns out that commenting the lines lines 648-649 does not break the test suite: there is no need to save So IMO, those lines in cloudpickle do not serve any use-case. In addition, they are pretty hard to understand at first sight. So I wanted to clarify the way we handle the presence of a There are two ways we can do that:
I am fine with both ways. I simply stumbled across those lines many times, and was always confused by their purpose/the use-case they served - this PR was an attempt to rationalize and clearly document them. Suggestions welcomed. |
Co-Authored-By: Olivier Grisel <[email protected]>
Co-Authored-By: Olivier Grisel <[email protected]>
Closes #282