Vinay Sajip added the comment:

> I think we can special-case small arrays in PyCStructUnionType_update_stgdict

Is that definitely the right place? And is doing it only for small arrays going 
to be enough? Currently, PyCStructUnionType_update_stgdict does

dict = PyType_stgdict(desc);

and then

stgdict->ffi_type_pointer.elements[ffi_ofs + i] = &dict->ffi_type_pointer;

where dict is the ctypes object for the field type. If the ffi_type_pointer is 
used all over the place because arrays usually degenerate to pointers, and 
changing it would cause breakage elsewhere, maybe the answer is to have a new 
ffi_type_array field which is NULL for non-array types and set correctly for 
array types; then the above code can check for a non-NULL ffi_type_array and 
use that instead of the ffi_type_pointer? Or am I talking nonsense?

Oddly (or perhaps not), this failure doesn't seem to occur on Windows - no 
crash happens and the correct value is returned from a function which sums the 
array, as in this example. See attached patch.

----------
keywords: +patch
Added file: http://bugs.python.org/file46652/fix-22273-01.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22273>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to