Issue #18408: Fix ConvParam() of the ctypes module to handle paramfunc failure

(MemoryError).
This commit is contained in:
Victor Stinner 2013-07-09 00:27:12 +02:00
parent 78094ac53e
commit 3f15cf0961
1 changed files with 2 additions and 0 deletions

View File

@ -620,6 +620,8 @@ static int ConvParam(PyObject *obj, Py_ssize_t index, struct argument *pa)
assert(dict->paramfunc);
/* If it has an stgdict, it is a CDataObject */
carg = dict->paramfunc((CDataObject *)obj);
if (carg == NULL)
return -1;
pa->ffi_type = carg->pffi_type;
memcpy(&pa->value, &carg->value, sizeof(pa->value));
pa->keep = (PyObject *)carg;