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 Ayappan, BTaskaya, David.Edelsohn, Michael.Felt, T.Rex, amaury.forgeotdarc, belopolsky, eryksun, meador.inge, ronaldoussoren, sanket, vinay.sajip
Date 2020-08-15.19:32:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1597519937.65.0.729375500858.issue38628@roundup.psfhosted.org>
In-reply-to
Content
> 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 :-(
History
Date User Action Args
2020-08-15 19:32:17vinay.sajipsetrecipients: + vinay.sajip, ronaldoussoren, amaury.forgeotdarc, belopolsky, meador.inge, eryksun, David.Edelsohn, Michael.Felt, Ayappan, BTaskaya, sanket, T.Rex
2020-08-15 19:32:17vinay.sajipsetmessageid: <1597519937.65.0.729375500858.issue38628@roundup.psfhosted.org>
2020-08-15 19:32:17vinay.sajiplinkissue38628 messages
2020-08-15 19:32:17vinay.sajipcreate