cpython: a8b30fd6ee4f (original) (raw)

Mercurial > cpython

changeset 89787:a8b30fd6ee4f 3.4

Close #20839: pkgutil.find_loader now uses importlib.util.find_spec [#20839]

Nick Coghlan ncoghlan@gmail.com
date Tue, 04 Mar 2014 20:39:42 +1000
parents 2c5a5fa0692c
children c97d80985b71
files Doc/library/pkgutil.rst Lib/pkgutil.py Lib/test/test_pkgutil.py Misc/NEWS
diffstat 4 files changed, 41 insertions(+), 21 deletions(-)[+] [-] Doc/library/pkgutil.rst 17 Lib/pkgutil.py 17 Lib/test/test_pkgutil.py 19 Misc/NEWS 9

line wrap: on

line diff

--- a/Doc/library/pkgutil.rst +++ b/Doc/library/pkgutil.rst @@ -74,15 +74,17 @@ support. Retrieve a :pep:302 module loader for the given fullname.

.. function:: get_importer(path_item) @@ -109,14 +111,13 @@ support. not already imported, its containing package (if any) is imported, in order to establish the package __path__.

+ .. function:: iter_importers(fullname='')

--- a/Lib/pkgutil.py +++ b/Lib/pkgutil.py @@ -470,29 +470,22 @@ def get_loader(module_or_name): def find_loader(fullname): """Find a PEP 302 "loader" object for fullname

def extend_path(path, name):

--- a/Lib/test/test_pkgutil.py +++ b/Lib/test/test_pkgutil.py @@ -334,6 +334,25 @@ class ImportlibMigrationTests(unittest.T self.assertIsNotNone(pkgutil.get_loader("test.support")) self.assertEqual(len(w.warnings), 0)

+ +

+ def test_get_importer_avoids_emulation(self): # We use an illegal path so none of the path hooks should fire with check_warnings() as w:

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -12,6 +12,13 @@ Core and Builtins