Message288142
> 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. |
|
Date |
User |
Action |
Args |
2017-02-19 15:33:13 | vinay.sajip | set | recipients:
+ vinay.sajip, amaury.forgeotdarc, belopolsky, weeble, meador.inge, eryksun, Ilya.Kulakov, alexei.romanov |
2017-02-19 15:33:13 | vinay.sajip | set | messageid: <1487518393.83.0.175337248525.issue22273@psf.upfronthosting.co.za> |
2017-02-19 15:33:13 | vinay.sajip | link | issue22273 messages |
2017-02-19 15:33:13 | vinay.sajip | create | |
|