MCPcopy
hub / github.com/cloudpipe/cloudpickle / _module_reduce

Function _module_reduce

cloudpickle/cloudpickle.py:1009–1019  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

1007
1008
1009def _module_reduce(obj):
1010 if _should_pickle_by_reference(obj):
1011 return subimport, (obj.__name__,)
1012 else:
1013 # Some external libraries can populate the "__builtins__" entry of a
1014 # module's `__dict__` with unpicklable objects (see #316). For that
1015 # reason, we do not attempt to pickle the "__builtins__" entry, and
1016 # restore a default value for it at unpickling time.
1017 state = obj.__dict__.copy()
1018 state.pop("__builtins__", None)
1019 return dynamic_subimport, (obj.__name__, state)
1020
1021
1022def _method_reduce(obj):

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…