summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2007-10-24 19:37:27 (GMT)
committerThomas Heller <theller@ctypes.org>2007-10-24 19:37:27 (GMT)
commit39013cd4c0f76b7b6c34efe4e341618f0ad2027a (patch)
tree2112caf57961f78c961cdb552377778dcbbc7584 /Lib
parentbd1c68c94f0d5bc25b48f62c7527f51c754f2b6b (diff)
downloadcpython-39013cd4c0f76b7b6c34efe4e341618f0ad2027a.zip
cpython-39013cd4c0f76b7b6c34efe4e341618f0ad2027a.tar.gz
cpython-39013cd4c0f76b7b6c34efe4e341618f0ad2027a.tar.bz2
A 'PyObject *' parameter in PyErr_Format must use %S parameter, not %s.
Added unittest for calling a function with paramflags.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/ctypes/test/test_prototypes.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/ctypes/test/test_prototypes.py b/Lib/ctypes/test/test_prototypes.py
index 91b7e0d..e098e7b 100644
--- a/Lib/ctypes/test/test_prototypes.py
+++ b/Lib/ctypes/test/test_prototypes.py
@@ -48,6 +48,24 @@ class CharPointersTestCase(unittest.TestCase):
func.restype = c_long
func.argtypes = None
+ def test_paramflags(self):
+ # function returns c_void_p result,
+ # and has a required parameter named 'input'
+ prototype = CFUNCTYPE(c_void_p, c_void_p)
+ func = prototype(("_testfunc_p_p", testdll),
+ ((1, "input"),))
+
+ try:
+ func()
+ except TypeError as details:
+ self.failUnlessEqual(str(details), "required argument 'input' missing")
+ else:
+ self.fail("TypeError not raised")
+
+ self.failUnlessEqual(func(None), None)
+ self.failUnlessEqual(func(input=None), None)
+
+
def test_int_pointer_arg(self):
func = testdll._testfunc_p_p
func.restype = c_long