(obj)
| 1021 | |
| 1022 | |
| 1023 | def _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 | |
| 1036 | def _method_reduce(obj): |
nothing calls this directly
no test coverage detected