This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vinay.sajip
Recipients Ilya.Kulakov, alexei.romanov, amaury.forgeotdarc, belopolsky, eryksun, meador.inge, vinay.sajip, weeble
Date 2017-02-19.15:33:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1487518393.83.0.175337248525.issue22273@psf.upfronthosting.co.za>
In-reply-to
Content
> 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.
History
Date User Action Args
2017-02-19 15:33:13vinay.sajipsetrecipients: + vinay.sajip, amaury.forgeotdarc, belopolsky, weeble, meador.inge, eryksun, Ilya.Kulakov, alexei.romanov
2017-02-19 15:33:13vinay.sajipsetmessageid: <1487518393.83.0.175337248525.issue22273@psf.upfronthosting.co.za>
2017-02-19 15:33:13vinay.sajiplinkissue22273 messages
2017-02-19 15:33:13vinay.sajipcreate