[pypy-commit] pypy default: revert part of 310dcc241b1f: go back to having the module in sys.modules before

pjenvey noreply at buildbot.pypy.org
Thu Apr 17 01:35:07 CEST 2014


Author: Philip Jenvey <pjenvey at underboss.org>
Branch: 
Changeset: r70674:a7023a962605
Date: 2014-04-16 16:17 -0700
http://bitbucket.org/pypy/pypy/changeset/a7023a962605/

Log:	revert part of 310dcc241b1f: go back to having the module in
	sys.modules before init, otherwise py3k runs into trouble while
	bootstrapping sys with the new reloading fix

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -462,26 +462,23 @@
             raise oefmt(self.w_SystemError,
                         "getbuiltinmodule() called with non-builtin module %s",
                         name)
-        else:
-            # Add the module to sys.modules and initialize the module
-            # The order is important to avoid recursions.
-            from pypy.interpreter.module import Module
-            if isinstance(w_mod, Module):
-                if not reuse and w_mod.startup_called:
-                    # create a copy of the module.  (see issue1514)
-                    # eventlet patcher relies on this behaviour.
-                    w_mod2 = self.wrap(Module(self, w_name))
-                    self.setitem(w_modules, w_name, w_mod2)
-                    w_mod.getdict(self)  # unlazy w_initialdict
-                    self.call_method(w_mod2.getdict(self), 'update',
-                                     w_mod.w_initialdict)
-                    return w_mod2
-                #
-                w_mod.init(self)
 
-            # Add the module to sys.modules
+        # Add the module to sys.modules and initialize the module. The
+        # order is important to avoid recursions.
+        from pypy.interpreter.module import Module
+        if isinstance(w_mod, Module):
+            if not reuse and w_mod.startup_called:
+                # create a copy of the module.  (see issue1514) eventlet
+                # patcher relies on this behaviour.
+                w_mod2 = self.wrap(Module(self, w_name))
+                self.setitem(w_modules, w_name, w_mod2)
+                w_mod.getdict(self)  # unlazy w_initialdict
+                self.call_method(w_mod2.getdict(self), 'update',
+                                 w_mod.w_initialdict)
+                return w_mod2
             self.setitem(w_modules, w_name, w_mod)
-            return w_mod
+            w_mod.init(self)
+        return w_mod
 
     def get_builtinmodule_to_install(self):
         """NOT_RPYTHON"""


More information about the pypy-commit mailing list