[pypy-svn] r75964 - pypy/branch/reflex-support/pypy/module/cppyy
wlav at codespeak.net
wlav at codespeak.net
Wed Jul 7 12:46:52 CEST 2010
Author: wlav
Date: Wed Jul 7 12:46:51 2010
New Revision: 75964
Modified:
pypy/branch/reflex-support/pypy/module/cppyy/executor.py
pypy/branch/reflex-support/pypy/module/cppyy/interp_cppyy.py
Log:
Made method call also use executors.
Modified: pypy/branch/reflex-support/pypy/module/cppyy/executor.py
==============================================================================
--- pypy/branch/reflex-support/pypy/module/cppyy/executor.py (original)
+++ pypy/branch/reflex-support/pypy/module/cppyy/executor.py Wed Jul 7 12:46:51 2010
@@ -11,18 +11,27 @@
class LongExecutor(FunctionExecutor):
- def execute(self, space, func, num_args, args):
- result = capi.c_callstatic_l(func.cpptype.name, func.method_index, num_args, args)
+ def execute(self, space, func, cppthis, num_args, args):
+ if cppthis is not None:
+ result = capi.c_callmethod_l(func.cpptype.name, func.method_index, cppthis, num_args, args)
+ else:
+ result = capi.c_callstatic_l(func.cpptype.name, func.method_index, num_args, args)
return space.wrap(result)
class DoubleExecutor(FunctionExecutor):
- def execute(self, space, func, num_args, args):
- result = capi.c_callstatic_d(func.cpptype.name, func.method_index, num_args, args)
+ def execute(self, space, func, cppthis, num_args, args):
+ if cppthis is not None:
+ raise NotImplementedError
+ else:
+ result = capi.c_callstatic_d(func.cpptype.name, func.method_index, num_args, args)
return space.wrap(result)
class CStringExecutor(FunctionExecutor):
- def execute(self, space, func, num_args, args):
- lresult = capi.c_callstatic_l(func.cpptype.name, func.method_index, num_args, args)
+ def execute(self, space, func, cppthis, num_args, args):
+ if cppthis is not None:
+ raise NotImplementedError
+ else:
+ lresult = capi.c_callstatic_l(func.cpptype.name, func.method_index, num_args, args)
ccpresult = rffi.cast(rffi.CCHARP, lresult)
result = capi.charp2str_free(ccpresult)
return space.wrap(result)
Modified: pypy/branch/reflex-support/pypy/module/cppyy/interp_cppyy.py
==============================================================================
--- pypy/branch/reflex-support/pypy/module/cppyy/interp_cppyy.py (original)
+++ pypy/branch/reflex-support/pypy/module/cppyy/interp_cppyy.py Wed Jul 7 12:46:51 2010
@@ -48,11 +48,14 @@
self.arg_converters = None
def call(self, cppthis, args_w):
+ if self.executor is None:
+ raise OperationError(self.space.w_TypeError, self.space.wrap("return type not handled"))
+
args = self.prepare_arguments(args_w)
- result = capi.c_callmethod_l(self.cpptype.name, self.method_index,
- cppthis, len(args_w), args)
- self.free_arguments(args)
- return self.space.wrap(result)
+ try:
+ return self.executor.execute(self.space, self, cppthis, len(args_w), args)
+ finally:
+ self.free_arguments(args)
def _build_converters(self):
self.arg_converters = [converter.get_converter(arg_type)
@@ -100,7 +103,7 @@
assert not cppthis
args = self.prepare_arguments(args_w)
try:
- return self.executor.execute(self.space, self, len(args_w), args)
+ return self.executor.execute(self.space, self, None, len(args_w), args)
finally:
self.free_arguments(args)
More information about the Pypy-commit
mailing list