Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions cloudpickle/cloudpickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,14 @@ def save_module(self, obj):
"""
mod_name = obj.__name__
# If module is successfully found then it is not a dynamically created module
try:
_find_module(mod_name)
if hasattr(obj, '__file__'):
is_dynamic = False
except ImportError:
is_dynamic = True
else:
try:
_find_module(mod_name)
is_dynamic = False
except ImportError:
is_dynamic = True

self.modules.add(obj)
if is_dynamic:
Expand Down