cpython: e961a166dc70 (original) (raw)

--- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -901,7 +901,7 @@ find and load modules. .. attribute:: has_location

:mod:importlib.util -- Utility code for importers

--- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -841,6 +841,10 @@ class ModuleSpec: def has_location(self): return self._set_fileattr

+ def spec_from_loader(name, loader, *, origin=None, is_package=None): """Return a module spec based on various loader methods."""

--- a/Lib/test/test_importlib/test_spec.py +++ b/Lib/test/test_importlib/test_spec.py @@ -116,6 +116,13 @@ class ModuleSpecTests: self.assertIs(spec.cached, None) self.assertFalse(spec.has_location)

+ def test_equality(self): other = type(sys.implementation)(name=self.name, loader=self.loader,

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -105,6 +105,8 @@ Library

--- a/Python/importlib.h +++ b/Python/importlib.h @@ -1313,7 +1313,7 @@ const unsigned char _Py_M__importlib[] = 0,114,212,0,0,0,204,2,0,0,115,6,0,0,0,12, 2,12,4,12,7,114,212,0,0,0,99,0,0,0,0,0, 0,0,0,0,0,0,0,8,0,0,0,64,0,0,0,115,

};