[pypy-commit] pypy test-cpyext: Get import_extension() to work on -A

rlamy pypy.commits at gmail.com
Mon Oct 3 13:14:34 EDT 2016


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: test-cpyext
Changeset: r87544:ea8a4682f5fe
Date: 2016-10-02 03:55 +0100
http://bitbucket.org/pypy/pypy/changeset/ea8a4682f5fe/

Log:	Get import_extension() to work on -A (grafted from
	14eb3647cc89644282cae04969c5f44628c6c7cb)

diff --git a/pypy/module/cpyext/test/test_cpyext.py b/pypy/module/cpyext/test/test_cpyext.py
--- a/pypy/module/cpyext/test/test_cpyext.py
+++ b/pypy/module/cpyext/test/test_cpyext.py
@@ -242,6 +242,16 @@
                     PY_SSIZE_T_CLEAN=PY_SSIZE_T_CLEAN)
             cls.w_import_module = w_import_module
 
+            def w_import_extension(self, modname, w_functions, prologue="",
+                include_dirs=None, more_init="", PY_SSIZE_T_CLEAN=False):
+                from extbuild import get_sys_info_app
+                sys_info = get_sys_info_app(self.udir)
+                return sys_info.import_extension(
+                    modname, w_functions, prologue=prologue,
+                    include_dirs=include_dirs, more_init=more_init,
+                    PY_SSIZE_T_CLEAN=PY_SSIZE_T_CLEAN)
+            cls.w_import_extension = w_import_extension
+
     def record_imported_module(self, name):
         """
         Record a module imported in a test so that it can be cleaned up in
@@ -313,8 +323,6 @@
         if self.runappdirect:
             self.compile_module = self.sys_info.compile_extension_module
             self.load_module = self.sys_info.load_module
-            self.import_module = self.sys_info.import_module
-            self.import_extension = self.sys_info.import_extension
         else:
             wrap = self.space.wrap
             self.w_compile_module = wrap(interp2app(compile_module))


More information about the pypy-commit mailing list