Skip to content

gh-148573: correct allocation of complex types in the ctypes#148579

Open
skirpichev wants to merge 1 commit intopython:mainfrom
skirpichev:fix-148573
Open

gh-148573: correct allocation of complex types in the ctypes#148579
skirpichev wants to merge 1 commit intopython:mainfrom
skirpichev:fix-148573

Conversation

@skirpichev
Copy link
Copy Markdown
Member

@skirpichev skirpichev commented Apr 14, 2026

Old code relying on implementation detail, that elements[1] for the FFI_TYPE_COMPLEX was never read.

But this type actually shares same assumption as the FFI_TYPE_STRUCT: the elements field is a NULL-terminated array of pointers to ffi_type objects. So far for primitive types - only complex types have this struct field as non-NULL (two element array).

Old code relying on implementation detail, that elements[1] for
the FFI_TYPE_COMPLEX was never read.

But this type actually shares same assumption as the FFI_TYPE_STRUCT:
the elements field is a NULL-terminated array of pointers to ffi_type
objects.  So far for primitive types - only complex types have this
struct field as non-NULL (two element array).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant