[pypy-svn] pypy default: (fijal, arigo)

arigo commits-noreply at bitbucket.org
Thu Jan 20 14:24:33 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r41017:26393ea16338
Date: 2011-01-20 14:24 +0100
http://bitbucket.org/pypy/pypy/changeset/26393ea16338/

Log:	(fijal, arigo)

	Just a hack.

diff --git a/lib_pypy/_ctypes_test.py b/lib_pypy/_ctypes_test.py
--- a/lib_pypy/_ctypes_test.py
+++ b/lib_pypy/_ctypes_test.py
@@ -5,9 +5,6 @@
 # Monkeypatch & hacks to let ctypes.tests import.
 # This should be removed at some point.
 sys.getrefcount = lambda x: len(gc.get_referrers(x)) - 1
-import _ctypes
-_ctypes.PyObj_FromPtr = None
-del _ctypes
 
 def compile_shared():
     """Compile '_ctypes_test.c' into an extension module, and import it
@@ -55,4 +52,12 @@
     fp, filename, description = imp.find_module('_ctypes_test', path=[output_dir])
     imp.load_module('_ctypes_test', fp, filename, description)
 
-compile_shared()
+
+try:
+    import _ctypes
+    _ctypes.PyObj_FromPtr = None
+    del _ctypes
+except ImportError:
+    pass    # obscure condition of _ctypes_test.py being imported by py.test
+else:
+    compile_shared()


More information about the Pypy-commit mailing list