You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2018-09-22.17:56:12.924>labels= ['ctypes', 'type-bug']
title='test_ctypes failing on Linux SPARC64'updated_at=<Date2018-09-30.18:22:03.191>user='https://github.com/kelledin'
Python 3.6.6 on Linux 4.16.18 SPARC64 fails test_ctypes. Specifically, it appears to be due to the _testfunc_large_struct_update_value() or _testfunc_reg_struct_update_value():
Obviously, the "0xbadf00d" field setting is propagating back up through something that's supposed to be passed-by-value, and the test case quite rightly picks up on it. I suspect this bug exists in 2.7.15 as well (2.7 just doesn't have the testcase to catch it).
This is built with gcc-8.2.0, glibc-2.27, kernel 4.16.18, CFLAGS="-O1 -mcpu=v9 -mtune=v9". (FYI I had to turn down optimization to resolve another test failure, hence the "-O1".)
I'm guessing SPARC64 calling conventions are still passing certain large values by reference, and libffi isn't dealing with this? I'm still investigating. I've tried it with and without --with-system-libffi, with no difference (my system libffi is 3.2.1).
Seems to be a common theme on various 64-bit ABIs. There is already a fix for Python’s Windows copy of the FFI library (bpo-29565), and a “hack” for Arm and x86 Windows (again!): bpo-30353.
This is based on #ifdef checks in libffi, but somewhat more generalized. The good news is, this appears to resolve all test_ctypes failures. So I'm guessing this is necessary on Linux/SPARC64, though I can't tell if it's necessary for Solaris/SPARC64. I don't even know what built-in compiler defines get turned on for Solaris, though someone else might.
It might also be advisable to backport this to Python 2.7, but obviously we should also backport the additional ctypes tests if we do that.
My biggest concern is, do these hacks have a purely performance-centric impact, or do they potentially degrade functionality as well?
I just tested this with Solaris 11.4 SPARC, and interestingly, we don't see any issues with test_ctypes. I tried running it both with and without your suggested change, and all tests passed in both cases. That said, this bug is pretty old now, and it's possible that things changed since then.
SPARC is unsupported per PEP-11. We don't have the means to test this issue. I'd be happy to merge a PR to add something clearly SPARC-specific to that #if, if a SPARC mainainer told me it fixes the tests. But, let's not track the issue here.
I'll close the bug and PR.
Like other issues for unsupported platforms, it'll be listed on the GitHub project for anyone who wants to support the platform unofficially or bring support back.
I encourage such people to add themselves to the Experts list so we know whom to ping.
Activity
kelledin commentedon Sep 22, 2018
Python 3.6.6 on Linux 4.16.18 SPARC64 fails test_ctypes. Specifically, it appears to be due to the _testfunc_large_struct_update_value() or _testfunc_reg_struct_update_value():
Obviously, the "0xbadf00d" field setting is propagating back up through something that's supposed to be passed-by-value, and the test case quite rightly picks up on it. I suspect this bug exists in 2.7.15 as well (2.7 just doesn't have the testcase to catch it).
This is built with gcc-8.2.0, glibc-2.27, kernel 4.16.18, CFLAGS="-O1 -mcpu=v9 -mtune=v9". (FYI I had to turn down optimization to resolve another test failure, hence the "-O1".)
I'm guessing SPARC64 calling conventions are still passing certain large values by reference, and libffi isn't dealing with this? I'm still investigating. I've tried it with and without --with-system-libffi, with no difference (my system libffi is 3.2.1).
kelledin commentedon Sep 26, 2018
Further details:
I cloned libffi from a few days ago to see if I had any different behavior. So far the test fails the same way with the updated libffi.
I'll also see about contacting libffi upstream and see what they can suggest here.
vadmium commentedon Sep 28, 2018
Seems to be a common theme on various 64-bit ABIs. There is already a fix for Python’s Windows copy of the FFI library (bpo-29565), and a “hack” for Arm and x86 Windows (again!): bpo-30353.
kelledin commentedon Sep 28, 2018
FYI the libffi bug report is open here:
libffi/libffi#451
As noted in the bug report, this issue actually doesn't appear to impact ARM64 (or ARM32 GNUEABI/GNUEABIHF).
kelledin commentedon Sep 30, 2018
Well, after perusing the ctypes callproc.c code, I found the hacks referenced by martin.panter and tried activating them with some SPARC64 #ifdefs:
This is based on #ifdef checks in libffi, but somewhat more generalized. The good news is, this appears to resolve all test_ctypes failures. So I'm guessing this is necessary on Linux/SPARC64, though I can't tell if it's necessary for Solaris/SPARC64. I don't even know what built-in compiler defines get turned on for Solaris, though someone else might.
It might also be advisable to backport this to Python 2.7, but obviously we should also backport the additional ctypes tests if we do that.
My biggest concern is, do these hacks have a purely performance-centric impact, or do they potentially degrade functionality as well?
kulikjak commentedon Dec 7, 2023
I just tested this with Solaris 11.4 SPARC, and interestingly, we don't see any issues with
test_ctypes. I tried running it both with and without your suggested change, and all tests passed in both cases. That said, this bug is pretty old now, and it's possible that things changed since then.I tested this with Python 3.11 and libffi 3.4.4.
encukou commentedon Sep 17, 2024
SPARC is unsupported per PEP-11. We don't have the means to test this issue. I'd be happy to merge a PR to add something clearly SPARC-specific to that
#if, if a SPARC mainainer told me it fixes the tests. But, let's not track the issue here.I'll close the bug and PR.
Like other issues for unsupported platforms, it'll be listed on the GitHub project for anyone who wants to support the platform unofficially or bring support back.
I encourage such people to add themselves to the Experts list so we know whom to ping.