diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_ctypes/callbacks.c | 2 | ||||
-rw-r--r-- | Modules/_ctypes/callproc.c | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/Modules/_ctypes/callbacks.c b/Modules/_ctypes/callbacks.c index bb59456..7dd1f99 100644 --- a/Modules/_ctypes/callbacks.c +++ b/Modules/_ctypes/callbacks.c @@ -399,7 +399,7 @@ CThunkObject *_ctypes_alloc_callback(PyObject *callable, #endif result = ffi_prep_cif(&p->cif, cc, Py_SAFE_DOWNCAST(nargs, Py_ssize_t, int), - _ctypes_get_ffi_type(restype), + p->ffi_restype, &p->atypes[0]); if (result != FFI_OK) { PyErr_Format(PyExc_RuntimeError, diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c index 4a6b8ec..720c4c0 100644 --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -1209,7 +1209,12 @@ PyObject *_ctypes_callproc(PPROC pProc, } } - rtype = _ctypes_get_ffi_type(restype); + if (restype == Py_None) { + rtype = &ffi_type_void; + } else { + rtype = _ctypes_get_ffi_type(restype); + } + resbuf = alloca(max(rtype->size, sizeof(ffi_arg))); #ifdef _Py_MEMORY_SANITIZER |