Issue #23014: Make importlib.abc.Loader.create_module() required when

importlib.abc.Loader.exec_module() is also defined.

Before this change, create_module() was optional **and** could return
None to trigger default semantics. This change now reduces the
options for choosing default semantics to one and in the most
backporting-friendly way (define create_module() to return None).
This commit is contained in:
Brett Cannon 2015-01-09 11:39:21 -05:00
parent 863c69cfeb
commit 02d8454002
11 changed files with 2440 additions and 2347 deletions

View file

@ -104,6 +104,9 @@ class PkgutilTests(unittest.TestCase):
class PkgutilPEP302Tests(unittest.TestCase):
class MyTestLoader(object):
def create_module(self, spec):
return None
def exec_module(self, mod):
# Count how many times the module is reloaded
mod.__dict__['loads'] = mod.__dict__.get('loads', 0) + 1