Uh oh!
There was an error while loading. Please reload this page.
ENH Add a switch to override existing global variables - #216
ENH Add a switch to override existing global variables#216pierreglaser wants to merge 8 commits into
Conversation
Codecov Report
@@ Coverage Diff @@## master #216 +/- ##
========================================
+ Coverage 84.92% 85% +0.07%
========================================
Files 1 1 Lines 577 580 +3 Branches 114 115 +1 ========================================
+ Hits 490 493 +3
Misses 63 63 Partials 24 24
Continue to review full report at Codecov.
|
Uh oh!
There was an error while loading. Please reload this page.
tomMoral
left a comment
There was a problem hiding this comment.
Overall, this looks good.
I agree that override_existing_globals should be passed through the state to ensure compatibility.
Also, some nitpicks on the tests and comments.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
pierreglaser
commented
Nov 15, 2018
@suquark |
Uh oh!
There was an error while loading. Please reload this page.
0b818ac to
0f49713Compare
ogrisel
left a comment
There was a problem hiding this comment.
+1 on my side besides the following comments.
I think we need a changelog entry targeting the 0.7 version.
Uh oh!
There was an error while loading. Please reload this page.
| if state.get('override_existing_globals', True): | ||
| func.__globals__.update(state['globals']) | ||
| else: | ||
| for k, v in state['globals'].items(): |
There was a problem hiding this comment.
I would re-add the original comment for this block of the condition:
# Only set global variables that do not exist.Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
06f38ba to
f6d6337Compare
ogrisel
left a comment
There was a problem hiding this comment.
LGTM, please add an entry to the change log (for 0.7).
07f8a3e to
3f32518Comparemitar
commented
Jan 15, 2019
suquark
commented
Jan 16, 2019
ogrisel
commented
Jan 17, 2019
@suquark could you please provide more details? Do you have a standalone example of one such problematic recursive function? |
ogrisel
commented
Jan 30, 2019
Closing in favor of #240. |
Following #214.
This PR implements a switch called
override_existing_globals, available fromCloudPickler.__init__,cloudpickle.dumpsandcloudpickle.dump.True, the globals from a function originally created in the__main__module, dynamic modules or in a nested scope override the globals of the function's module at unpickling time.False, the existing variables in the function's module overrides the globals of those functions at unpickling time.