pyimod03_importers.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:mac-package-build 作者: persepolisdm 项目源码 文件源码
def load_module(self, fullname, path=None):
        # Deprecated in Python 3.4, see PEP-451
        imp_lock()

        try:
            # PEP302 If there is an existing module object named 'fullname'
            # in sys.modules, the loader must use that existing module.
            module = sys.modules.get(fullname)
            if module is None:
                module = imp.init_builtin(fullname)

        except Exception:
            # Remove 'fullname' from sys.modules if it was appended there.
            if fullname in sys.modules:
                sys.modules.pop(fullname)
            raise  # Raise the same exception again.

        finally:
            # Release the interpreter's import lock.
            imp_unlock()

        return module

    ### Optional Extensions to the PEP-302 Importer Protocol
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号