MCPcopy Create free account
hub / github.com/cloudpipe/cloudpickle / _module_reduce

Function _module_reduce

cloudpickle/cloudpickle.py:1023–1033  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

1021
1022
1023def _module_reduce(obj):
1024 if _should_pickle_by_reference(obj):
1025 return subimport, (obj.__name__,)
1026 else:
1027 # Some external libraries can populate the "__builtins__" entry of a
1028 # module's `__dict__` with unpicklable objects (see #316). For that
1029 # reason, we do not attempt to pickle the "__builtins__" entry, and
1030 # restore a default value for it at unpickling time.
1031 state = obj.__dict__.copy()
1032 state.pop("__builtins__", None)
1033 return dynamic_subimport, (obj.__name__, state)
1034
1035
1036def _method_reduce(obj):

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected