Armin Rigo committed 26393ea

(fijal, arigo)

Just a hack.

  • Participants
  • Parent commits 950f091

Comments (0)

Files changed (1)

File lib_pypy/

 # 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
     fp, filename, description = imp.find_module('_ctypes_test', path=[output_dir])
     imp.load_module('_ctypes_test', fp, filename, description)
+    import _ctypes
+    _ctypes.PyObj_FromPtr = None
+    del _ctypes
+except ImportError:
+    pass    # obscure condition of being imported by py.test
+    compile_shared()