[pypy-svn] r75899 - in pypy/branch/reflex-support/pypy/module/cppyy: . test
cfbolz at codespeak.net
cfbolz at codespeak.net
Tue Jul 6 13:13:15 CEST 2010
Author: cfbolz
Date: Tue Jul 6 13:13:14 2010
New Revision: 75899
Modified:
pypy/branch/reflex-support/pypy/module/cppyy/interp_cppyy.py
pypy/branch/reflex-support/pypy/module/cppyy/test/test_cppyy.py
Log:
(wlav, cfbolz, antocuni, arigo around): test and fix
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 Tue Jul 6 13:13:14 2010
@@ -82,6 +82,8 @@
compilation_info=eci)
+NULL_VOIDP = lltype.nullptr(rffi.VOIDP.TO)
+
def load_lib(space, name):
cdll = CDLL(name)
return W_CPPLibrary(space, cdll)
@@ -100,7 +102,7 @@
except:
# fun :-(
for j in range(i):
- lltype.free(args[j])
+ lltype.free(args[j], flavor='raw')
lltype.free(args, flavor='raw')
raise
return args
@@ -146,7 +148,7 @@
class CPPFunction(CPPMethod):
def call(self, cppthis, args_w):
- assert cppthis is None
+ assert not cppthis
args = prepare_arguments(self.space, args_w, self.arg_types)
if self.result_type == "int":
result = callstatic_l(self.cpptype.name, self.method_index, len(args_w), args)
@@ -161,7 +163,7 @@
class CPPConstructor(CPPFunction):
def call(self, cppthis, args_w):
- assert cppthis is None
+ assert not cppthis
args = prepare_arguments(self.space, args_w, self.arg_types)
result = construct(self.cpptype.name, len(args_w), args)
free_arguments(args, len(args_w))
@@ -234,11 +236,11 @@
def invoke(self, name, args_w):
overload = self.function_members[name]
- return overload.call(None, args_w)
+ return overload.call(NULL_VOIDP, args_w)
def construct(self, args_w):
overload = self.function_members[self.name]
- return W_CPPObject(self, overload.call(None, args_w))
+ return W_CPPObject(self, overload.call(NULL_VOIDP, args_w))
W_CPPType.typedef = TypeDef(
'CPPType',
Modified: pypy/branch/reflex-support/pypy/module/cppyy/test/test_cppyy.py
==============================================================================
--- pypy/branch/reflex-support/pypy/module/cppyy/test/test_cppyy.py (original)
+++ pypy/branch/reflex-support/pypy/module/cppyy/test/test_cppyy.py Tue Jul 6 13:13:14 2010
@@ -36,6 +36,8 @@
assert res == 2
res = t.invoke("add1", 1, 2)
assert res == 4
+ raises(TypeError, 't.invoke("add1", 1, [])')
+
def test_example01static_double(self):
t = self.example01.type_byname("example01")
@@ -54,3 +56,4 @@
instance.destruct()
count = t.invoke("getcount")
assert count == 0
+
More information about the Pypy-commit
mailing list