Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using add exec_module in the _ImportRedirect #1436

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions bottle.py
Expand Up @@ -2050,8 +2050,10 @@ def __init__(self, name, impmask):
'__loader__': self
})
sys.meta_path.append(self)
self.fullname = None

def find_spec(self, fullname, path, target=None):
self.fullname = fullname
if '.' not in fullname: return
if fullname.rsplit('.', 1)[0] != self.name: return
from importlib.util import spec_from_loader
Expand All @@ -2072,6 +2074,13 @@ def load_module(self, fullname):
module.__loader__ = self
return module

def create_module(self, spec):
if self.fullname:
return self.load_module(self.fullname)

def exec_module(self, module):
pass

###############################################################################
# Common Utilities #############################################################
###############################################################################
Expand Down