Thomas Heller added the comment:

Looking again, I found a bug in the patch.

In the function _get_args(), the local variable 'name' was
changed from 'char *' to 'PyObject *'.  In line 2995, it is
passed to PyErr_Format with a '%s' format code:

        if (name)
                PyErr_Format(PyExc_TypeError,
==>                          "required argument '%s' missing", name);

A unittest but no fix for the bug for this issue is
attached (can I submit patches via mail?)

Added file: http://bugs.python.org/file8602/test_prototypes.patch

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1319>
__________________________________
Index: test_prototypes.py
===================================================================
--- test_prototypes.py  (revision 58625)
+++ test_prototypes.py  (working copy)
@@ -48,6 +48,24 @@
         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
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to