]> granicus.if.org Git - python/commitdiff
pyexpat/xml.parsers.expat create their errors and model modules from
authorBrett Cannon <brett@python.org>
Sun, 3 Feb 2013 16:37:13 +0000 (11:37 -0500)
committerBrett Cannon <brett@python.org>
Sun, 3 Feb 2013 16:37:13 +0000 (11:37 -0500)
scratch. This means they do not set __loader__ by default. This is
acceptable under importlib/PEP 302 definitions, so relax the test that
was trying to apply this universally.

Lib/test/test_importlib/test_api.py

index 5d63d85b09e74310ac89c1e88bf052cdf0f036f8..162354b254ba549221313ec5c7fe68d56dd51af1 100644 (file)
@@ -182,6 +182,10 @@ class StartupTests(unittest.TestCase):
         # Issue #17098: all modules should have __loader__ defined.
         for name, module in sys.modules.items():
             if isinstance(module, types.ModuleType):
+                # pyexpat/xml.parsers.expat have submodules that it creates
+                # by hand and do not set __loader__, which is acceptable.
+                if 'expat' in name:
+                    continue
                 self.assertTrue(hasattr(module, '__loader__'),
                         '{!r} lacks a __loader__ attribute'.format(name))
                 if name in sys.builtin_module_names: