Skip to content

Commit 4d45d6e

Browse files
committed
DOC document __builtins__ of modules are not pickled
1 parent 8471ca3 commit 4d45d6e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Diff for: cloudpickle/cloudpickle_fast.py

+4
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,10 @@ def _module_reduce(obj):
342342
if _is_importable(obj):
343343
return subimport, (obj.__name__,)
344344
else:
345+
# Some external libraries can populate the "__builtins__" entry of a
346+
# module's `__dict__` with unpicklable objects (see #316). For that
347+
# reason, we do not attempt to pickle the "__builtins__" entry, and
348+
# restore a default value for it at unpickling time.
345349
state = obj.__dict__.copy()
346350
state.pop('__builtins__', None)
347351
return dynamic_subimport, (obj.__name__, state)

0 commit comments

Comments
 (0)