[pypy-svn] r79768 - pypy/branch/jitypes2/lib_pypy/_ctypes

antocuni at codespeak.net antocuni at codespeak.net
Fri Dec 3 10:14:50 CET 2010


Author: antocuni
Date: Fri Dec  3 10:14:48 2010
New Revision: 79768

Modified:
   pypy/branch/jitypes2/lib_pypy/_ctypes/function.py
Log:
kill this hack. The goal now is to have something that works, we will make it jit-friendly later


Modified: pypy/branch/jitypes2/lib_pypy/_ctypes/function.py
==============================================================================
--- pypy/branch/jitypes2/lib_pypy/_ctypes/function.py	(original)
+++ pypy/branch/jitypes2/lib_pypy/_ctypes/function.py	Fri Dec  3 10:14:48 2010
@@ -240,8 +240,6 @@
             ffi_argtypes = [self._shape_to_ffi_type(shape) for shape in argshapes]
             ffi_restype = self._shape_to_ffi_type(resshape)
             self._ptr = cdll.getfunc(self.name, ffi_argtypes, ffi_restype)
-            if len(ffi_argtypes) == 1:
-                self.__class__ = _FuncPtr_1_arg # black magic
             return self._ptr
         except AttributeError:
             if self._flags_ & _rawffi.FUNCFLAG_CDECL:
@@ -429,26 +427,3 @@
                 self._ptr.free()
                 self._ptr = None
             self._needs_free = False
-
-
-# hack hack
-
-#import ctypes
-class _FuncPtr_1_arg(CFuncPtr):
-
-    def _rollback(self, *args):
-        self.__class__ = CFuncPtr
-        return self(*args)
-
-    def __call__(self, arg0):
-        if self.callable is not None or self._com_index:
-            return self._rollback(arg0)
-
-        #argtypes, argsandobjs = self._wrap_args(argtypes, args)
-
-        argtypes = self._argtypes_
-        restype = self._restype_
-        thisarg = None
-        funcptr = self._getfuncptr(argtypes, restype, thisarg)
-        return funcptr(arg0)
-



More information about the Pypy-commit mailing list