David Edelsohn <dje....@gmail.com> added the comment:

As mentioned in the stgdict.c comment, this relates back to #22273 and #29565. 
The passing of arrays/structs is fragile, to use a euphemism. The ctypes 
behavior conforms to the x64 Linux ABI and x64 libffi, even the comment from 
#22273,

"Structs that are larger than 32 bytes get copied to the stack (see 
classify_argument in ffi64.c), so we don't have to worry about classifying 
their elements for register passing. Thus if a new field is added for this in 
StgDictObject, then PyCArrayType_new should only allocate it for array types 
that are 32 bytes or less. Using it for larger array types would serve no point.

And now we're at the crux of the problem.  I don't know what Ronald and others 
recommend.  ctypes is choosing x64 behavior to define an inherently 
target-dependent and ABI-dependent design decisions.  The real solution 
requires that _ctypes/stgdict.c incorporate target-specific logic, but it's not 
clear that the Python community wants to go down that path.

----------

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

Reply via email to