https://github.com/python/cpython/commit/f2c7c0d2b799c927d9a78e87e4a640d3f9b0356c
commit: f2c7c0d2b799c927d9a78e87e4a640d3f9b0356c
branch: main
author: sunmy2019 <[email protected]>
committer: encukou <[email protected]>
date: 2026-05-01T14:12:08+02:00
summary:
gh-148967: Fix FFI type pointer handling for C complex support in
set_stginfo_ffi_type_pointer (GH-148969)
files:
M Modules/_ctypes/_ctypes.c
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 0bdc30a0cb3836..5325321efe75cd 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -2225,6 +2225,7 @@ c_void_p_from_param_impl(PyObject *type, PyTypeObject
*cls, PyObject *value)
static int
set_stginfo_ffi_type_pointer(StgInfo *stginfo, struct fielddesc *fmt)
{
+#if defined(_Py_FFI_SUPPORT_C_COMPLEX)
if (!fmt->pffi_type->elements) {
stginfo->ffi_type_pointer = *fmt->pffi_type;
}
@@ -2244,6 +2245,10 @@ set_stginfo_ffi_type_pointer(StgInfo *stginfo, struct
fielddesc *fmt)
memcpy(stginfo->ffi_type_pointer.elements,
fmt->pffi_type->elements, els_size);
}
+#else
+ assert(!fmt->pffi_type->elements);
+ stginfo->ffi_type_pointer = *fmt->pffi_type;
+#endif
return 0;
}
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]