[pypy-svn] r26276 - pypy/dist/pypy/objspace/cpy
arigo at codespeak.net
arigo at codespeak.net
Mon Apr 24 20:06:55 CEST 2006
Author: arigo
Date: Mon Apr 24 20:06:54 2006
New Revision: 26276
Modified:
pypy/dist/pypy/objspace/cpy/wrappable.py
Log:
Make test_wrappable pass. The problem is that ctypes doesn't
support callbacks of CPython calling conventions -- only of
general C calling conventions. Hack hack hack needed.
Modified: pypy/dist/pypy/objspace/cpy/wrappable.py
==============================================================================
--- pypy/dist/pypy/objspace/cpy/wrappable.py (original)
+++ pypy/dist/pypy/objspace/cpy/wrappable.py Mon Apr 24 20:06:54 2006
@@ -36,4 +36,15 @@
)
w_result = PyCFunction_NewEx(byref(ml), None, func.w_module)
w_result.ml = ml # keep ml alive as long as w_result is around
- return w_result
+
+ # argh! callbacks of mode PyDLL are not supported by ctypes so far
+ # (as of 0.9.9.4). XXX hack. I am not happy.
+
+ def hackish_trampoline(*args):
+ args_w = [space.W_Object(a) for a in args]
+ w_result = bltin(space, *args_w)
+ return w_result.value
+
+ w_pseudoresult = W_Object(hackish_trampoline)
+ w_pseudoresult._hack_replace_with_ = w_result
+ return w_pseudoresult
More information about the Pypy-commit
mailing list