diff --git a/cloudpickle/cloudpickle.py b/cloudpickle/cloudpickle.py index e5a37fcea..d1b38f826 100644 --- a/cloudpickle/cloudpickle.py +++ b/cloudpickle/cloudpickle.py @@ -560,8 +560,11 @@ def _rebuild_tornado_coroutine(func): loads = pickle.loads -# hack for __import__ not working as desired def subimport(name): + # We cannot do simply: `return __import__(name)`: Indeed, if ``name`` is + # the name of a submodule, __import__ will return the top-level root module + # of this submodule. For instance, __import__('os.path') returns the `os` + # module. __import__(name) return sys.modules[name]