Vinay Sajip <vinay_sa...@yahoo.co.uk> added the comment:

> stgdict.c currently includes a target-specific work-around for small 
> structures that is not restricted to the one target (x64) affected. What's 
> the best way to proceed?

I think more data is needed to determine the best way to proceed. The original 
failure was for x64, but other targets may be affected too if structs below a 
certain size, when passed by value, are passed in registers - libffi would have 
incomplete information about how to pass the struct correctly, as arrays are 
normally encoded as pointers in libffi. Do we know for particular targets what 
the struct size limits are for passing by value in registers? If so, we could 
set the MAX_STRUCT_SIZE according to target.

I would suggest adding a test to Lib/ctypes/test/test_structures.py in the 
test_array_in_struct method (or an analogous test_38628 method), to get it to 
fail - rather than using the OP's MemchrArgsHack. Then any patches to the 
stgdict.c code would have to pass that test on all architectures. But, noting 
that test_array_in_struct passes 16-byte structures by value to a C function to 
verify correct passing of the struct - if these tests aren't failing on AIX 
now, how come? That test was failing on x64 before the stgdict.c patch was 
added, and started working afterwards. Unfortunately I don't have an AIX 
environment I can try things in :-(

----------

_______________________________________
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