Fix deprecation warning when importing a schema
`load_module` has been deprecated since Python 3.4. A warning is issued in recent releases: > ImportWarning: _Loader.exec_module() not found; falling back to load_module() See: https://docs.python.org/3/library/importlib.html#importlib.abc.Loader.load_module
This commit is contained in:
committed by
Jacob Alexander
parent
a89eb0dee6
commit
ef0f46a1c9
@@ -4421,16 +4421,14 @@ class _Loader:
|
|||||||
self.fullname = fullname
|
self.fullname = fullname
|
||||||
self.path = path
|
self.path = path
|
||||||
|
|
||||||
def load_module(self, fullname):
|
def create_module(self, _spec):
|
||||||
assert self.fullname == fullname, (
|
|
||||||
"invalid module, expected {}, got {}".format(self.fullname, fullname))
|
|
||||||
|
|
||||||
imports = _capnp_paths + [path if path != '' else '.' for path in _sys.path]
|
imports = _capnp_paths + [path if path != '' else '.' for path in _sys.path]
|
||||||
module = load(self.path, fullname, imports=imports)
|
module = load(self.path, self.fullname, imports=imports)
|
||||||
_sys.modules[fullname] = module
|
|
||||||
|
|
||||||
return module
|
return module
|
||||||
|
|
||||||
|
def exec_module(self, _module):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class _Importer:
|
class _Importer:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user