diff options
author | Thomas Heller <theller@ctypes.org> | 2006-07-06 08:48:35 (GMT) |
---|---|---|
committer | Thomas Heller <theller@ctypes.org> | 2006-07-06 08:48:35 (GMT) |
commit | 5becdbee96abef0ec5d5009618d7c3316678168e (patch) | |
tree | bf9e1813c6cfc7741827c97f0798500df0c27a5f /Modules | |
parent | 2329b64c20d0c8891102aa2fb65c836efeea3d7c (diff) | |
download | cpython-5becdbee96abef0ec5d5009618d7c3316678168e.zip cpython-5becdbee96abef0ec5d5009618d7c3316678168e.tar.gz cpython-5becdbee96abef0ec5d5009618d7c3316678168e.tar.bz2 |
Patch #1517790: It is now possible to use custom objects in the ctypes
foreign function argtypes sequence as long as they provide a
from_param method, no longer is it required that the object is a
ctypes type.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_ctypes/_ctypes.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index a36166d..17bb1e8 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -1633,9 +1633,8 @@ converters_from_argtypes(PyObject *ob) for (i = 0; i < nArgs; ++i) { PyObject *tp = PyTuple_GET_ITEM(ob, i); - StgDictObject *dict = PyType_stgdict(tp); PyObject *cnv = PyObject_GetAttrString(tp, "from_param"); - if (!dict || !cnv) + if (!cnv) goto argtypes_error_1; PyTuple_SET_ITEM(converters, i, cnv); } @@ -1646,7 +1645,7 @@ converters_from_argtypes(PyObject *ob) Py_XDECREF(converters); Py_DECREF(ob); PyErr_Format(PyExc_TypeError, - "item %d in _argtypes_ is not a valid C type", i+1); + "item %d in _argtypes_ has no from_param method", i+1); return NULL; } |