[pypy-commit] pypy default: Some modules do import other extension modules before their Py_InitModule

amauryfa noreply at buildbot.pypy.org
Sat Jun 4 01:11:22 CEST 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: 
Changeset: r44681:e422a0ec46e0
Date: 2011-06-04 00:54 +0200
http://bitbucket.org/pypy/pypy/changeset/e422a0ec46e0/

Log:	Some modules do import other extension modules before their
	Py_InitModule (pygame is one of them)

diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py
--- a/pypy/module/cpyext/api.py
+++ b/pypy/module/cpyext/api.py
@@ -966,6 +966,7 @@
     state = space.fromcache(State)
     if state.find_extension(name, path) is not None:
         return
+    old_context = state.package_context
     state.package_context = name, path
     try:
         from pypy.rlib import rdynload
@@ -991,7 +992,7 @@
         generic_cpy_call(space, initfunc)
         state.check_and_raise_exception()
     finally:
-        state.package_context = None, None
+        state.package_context = old_context
     state.fixup_extension(name, path)
 
 @specialize.ll()


More information about the pypy-commit mailing list