mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
A 'PyObject *' parameter in PyErr_Format must use %S parameter, not %s.
Added unittest for calling a function with paramflags.
This commit is contained in:
parent
bd1c68c94f
commit
39013cd4c0
2 changed files with 19 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue