[Python-checkins] cpython (3.3): pyexpat/xml.parsers.expat create their errors and model modules from

brett.cannon python-checkins at python.org
Sun Feb 3 17:39:43 CET 2013


http://hg.python.org/cpython/rev/fbeb79714f98
changeset:   81971:fbeb79714f98
branch:      3.3
parent:      81965:9040b3714207
user:        Brett Cannon <brett at python.org>
date:        Sun Feb 03 11:37:13 2013 -0500
summary:
  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.

files:
  Lib/test/test_importlib/test_api.py |  4 ++++
  1 files changed, 4 insertions(+), 0 deletions(-)


diff --git a/Lib/test/test_importlib/test_api.py b/Lib/test/test_importlib/test_api.py
--- a/Lib/test/test_importlib/test_api.py
+++ b/Lib/test/test_importlib/test_api.py
@@ -182,6 +182,10 @@
         # 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:

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list