Fix dill._dill
submodule being saved as GLOBAL "dill._shims" "_dill"
#490
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm tracing some problems with my "portable" mode prototype and hit a bug with references to the
_dill
submodule saved as global:The
_dill
submodule is saved as an attribute of thedill._shims
submodule, which is valid, but it should be justdill._dill
.The
_dill
submodule is special-cased to be saved as global:dill/dill/_dill.py
Lines 1807 to 1810 in 8e5e450
But
pickle.whichmodule
misidentifies it as pertaining todill._shims
, because this entry is set earlier insys.modules
and it picks the first match.The change fixes things for this especial case, but there is potential for new bugs related to other submodules:
Note how
_shims
is attributed todill._dill
andsettings
is attributed to__main__
(???). But currently they are not saved as globals.