Uh oh!
There was an error while loading. Please reload this page.
pass the __dict__ item of a class __dict__ - #291
Conversation
ca0c8c8 to
cdd0aa7CompareUh oh!
There was an error while loading. Please reload this page.
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.
|
pierreglaser
commented
Jun 17, 2019
Some updates: now that The guard ifnotisinstance(obj, types.GetSetDescriptorType) andgetattr(__dict__, '__objclass__', None), isnotobjserves the purpose of finding this default case. Also, now that we special-case the situation where |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## master #291 +/- ##
===========================================
- Coverage 92.84% 67.48% -25.36%
===========================================
Files 2 2 Lines 852 852 Branches 177 177 ===========================================
- Hits 791 575 -216 - Misses 37 257 +220 + Partials 24 20 -4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
pierreglaser
commented
Jun 17, 2019
The failure of |
ogrisel
commented
Jun 18, 2019
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
In fromcollectionsimportnamedtuplenamedtuple_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 <olivier.grisel@ensta.org>
Co-Authored-By: Olivier Grisel <olivier.grisel@ensta.org>
Closes#282