This patch removes the '_as_parameter_' public attribute of ctypes instances, and replaces the mechanism by an internal one. This mechanism is used to convert a ctypes instance to an (internal) PyCArgObject instance which can directly by used as an argument in a C function call. With this patch, a C function pointer which does create the PyCArgObject instance is stored in the type dictionary (an StgDict instance). This does speed up foreign function calls with one ctypes argument by about 20%, but more important, it will allow to fix the '_as_parameter_' mechanism, which is documented in [1], so that it actually will work as describes, even for functions that have 'argtypes' set. [1] http://docs.python.org/dev/lib/ctypes-calling-functions-with-own-custom-data-types.html
Logged In: YES user_id=11105 The previous patch was against the ctypes repository. I've deleted this patch and attached a new one against the Python svn trunk.
Logged In: YES user_id=33168 Please check this in ASAP and remember to make an entry in Misc/NEWS. Also, PyObject_stgdict() can return NULL, but the values aren't checked. There may be a few other unchecked returns.