Skip to content

Commit

Permalink
Check for dynamic module
Browse files Browse the repository at this point in the history
Add a condition while looking up modules to see if the module is
registered as dynamic, returning None if so. This means resources
belonging to modules registered as dynamic will be treated as if they
had no module, or belonged to __main__.
  • Loading branch information
kinghuang committed Jul 8, 2020
1 parent 79b82df commit f789f2f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cloudpickle/cloudpickle.py
Expand Up @@ -234,6 +234,9 @@ def _lookup_module_and_qualname(obj, name=None):
if module_name == "__main__":
return None

if _is_dynamic_module(module_name):
return None

# Note: if module_name is in sys.modules, the corresponding module is
# assumed importable at unpickling time. See #357
module = sys.modules.get(module_name, None)
Expand Down

0 comments on commit f789f2f

Please sign in to comment.