Commits

Philip Jenvey  committed eb1fd57

fix '__exceptions__' incorrectly showing up in sys.builtin_module_names as
'exceptions'

  • Participants
  • Parent commits ee4e63e
  • Branches py3k

Comments (0)

Files changed (2)

File pypy/interpreter/baseobjspace.py

     # order by the fake entry '.../lib_pypy/__extensions__'.
     MODULES_THAT_ALWAYS_SHADOW = dict.fromkeys([
         '__builtin__', '__pypy__', '_ast', '_codecs', '_sre', '_warnings',
-        '_weakref', 'errno', 'exceptions', 'gc', 'imp', 'marshal',
+        '_weakref', 'errno', '__exceptions__', 'gc', 'imp', 'marshal',
         'posix', 'nt', 'pwd', 'signal', 'sys', 'thread', 'zipimport',
     ], None)
 
         w_builtin.install()
         self.setitem(self.builtin.w_dict, self.wrap('__builtins__'), w_builtin)
 
+        # exceptions was bootstrapped as '__exceptions__' but still
+        # lives in pypy/module/exceptions, we rename it below for
+        # sys.builtin_module_names
         bootstrap_modules = set(('sys', 'imp', 'builtins', 'exceptions'))
         installed_builtin_modules = list(bootstrap_modules)
 
             if mixedname not in bootstrap_modules:
                 self.install_mixedmodule(mixedname, installed_builtin_modules)
 
+        installed_builtin_modules.remove('exceptions')
+        installed_builtin_modules.append('__exceptions__')
         installed_builtin_modules.sort()
         w_builtin_module_names = self.newtuple(
             [self.wrap(fn) for fn in installed_builtin_modules])

File pypy/module/sys/test/test_sysmodule.py

             "sys is not listed as a builtin module.")
         assert 'builtins' in names, (
             "builtins is not listed as a builtin module.")
+        assert 'exceptions' not in names, (
+            "exceptions module shouldn't exist")
 
     def test_sys_exc_info(self):
         try: