Skip to content

Commit d37a507

Browse files
committed
Fix FFI type pointer handling for C complex support in set_stginfo_ffi_type_pointer
1 parent 618b726 commit d37a507

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

Modules/_ctypes/_ctypes.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2225,6 +2225,7 @@ c_void_p_from_param_impl(PyObject *type, PyTypeObject *cls, PyObject *value)
22252225
static int
22262226
set_stginfo_ffi_type_pointer(StgInfo *stginfo, struct fielddesc *fmt)
22272227
{
2228+
#if defined(_Py_FFI_SUPPORT_C_COMPLEX)
22282229
if (!fmt->pffi_type->elements) {
22292230
stginfo->ffi_type_pointer = *fmt->pffi_type;
22302231
}
@@ -2244,6 +2245,10 @@ set_stginfo_ffi_type_pointer(StgInfo *stginfo, struct fielddesc *fmt)
22442245
memcpy(stginfo->ffi_type_pointer.elements,
22452246
fmt->pffi_type->elements, els_size);
22462247
}
2248+
#else
2249+
assert(!fmt->pffi_type->elements);
2250+
stginfo->ffi_type_pointer = *fmt->pffi_type;
2251+
#endif
22472252
return 0;
22482253
}
22492254

0 commit comments

Comments
 (0)