[pypy-commit] pypy default: Undo 68058ce4557d and add a comment

rlamy pypy.commits at gmail.com
Tue Jan 17 21:20:21 EST 2017


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: 
Changeset: r89650:47cc21180694
Date: 2017-01-18 02:01 +0000
http://bitbucket.org/pypy/pypy/changeset/47cc21180694/

Log:	Undo 68058ce4557d and add a comment

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -665,6 +665,11 @@
 
     def setup_builtin_modules(self):
         "NOT_RPYTHON: only for initializing the space."
+        if self.config.objspace.usemodules.cpyext:
+            # Special-case this to have state.install_dll() called early, which
+            # is required to initialise sys on Windows.
+            from pypy.module.cpyext.state import State
+            self.fromcache(State).build_api()
         self.getbuiltinmodule('sys')
         self.getbuiltinmodule('imp')
         self.getbuiltinmodule('__builtin__')
diff --git a/pypy/module/cpyext/__init__.py b/pypy/module/cpyext/__init__.py
--- a/pypy/module/cpyext/__init__.py
+++ b/pypy/module/cpyext/__init__.py
@@ -12,11 +12,6 @@
 
     atexit_funcs = []
 
-    def setup_after_space_initialization(self):
-        state = self.space.fromcache(State)
-        state.setup_rawrefcount()
-        state.build_api()
-
     def startup(self, space):
         space.fromcache(State).startup(space)
         method = pypy.module.cpyext.typeobject.get_new_method_def(space)
diff --git a/pypy/module/cpyext/state.py b/pypy/module/cpyext/state.py
--- a/pypy/module/cpyext/state.py
+++ b/pypy/module/cpyext/state.py
@@ -83,6 +83,7 @@
         This function is called when at object space creation,
         and drives the compilation of the cpyext library
         """
+        self.setup_rawrefcount()
         from pypy.module.cpyext import api
         if not self.space.config.translating:
             self.api_lib = str(api.build_bridge(self.space))


More information about the pypy-commit mailing list