From: Brett Cannon Date: Sun, 3 Feb 2013 16:37:13 +0000 (-0500) Subject: pyexpat/xml.parsers.expat create their errors and model modules from X-Git-Tag: v3.3.1rc1~237 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9de80ac127a9cd9fab39844fcf0a58d1f9720363;p=python pyexpat/xml.parsers.expat create their errors and model modules from 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. --- diff --git a/Lib/test/test_importlib/test_api.py b/Lib/test/test_importlib/test_api.py index 5d63d85b09..162354b254 100644 --- a/Lib/test/test_importlib/test_api.py +++ b/Lib/test/test_importlib/test_api.py @@ -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: