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
{{ message }}
Repository navigation
ctypes: pass by value for structs broken on Cygwin/MinGW 64-bit #74538
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=<Date2018-03-08.15:34:17.694>created_at=<Date2017-05-12.16:19:48.894>labels= ['ctypes', 'type-bug', '3.7']
title='ctypes: pass by value for structs broken on Cygwin/MinGW 64-bit'updated_at=<Date2018-03-08.15:34:17.692>user='https://github.com/embray'
Thanks for pointing that out. Indeed it's the same symptom, but slightly different cause. libffi has different implementations of its calling routines for different architectures/platforms depending on the machine architecture and calling conventions used. So this case is probably buggy for the arm64 implementation as well, as in bpo-29804.
Off the top of my head I don't know a reliable way to check for this case, but this fix would work around the arm64 issue as well if I could check for that architecture easily at compile time.
stratakis commented on May 15, 2017
stratakismannequin
Mannequin
More actions
A 'defined(aarch64)' can be used for the arm64 arch. I will add it to your patch and test it on an arm64 machine to see if the test passes.
irushchyshyn commented on May 16, 2017
irushchyshynmannequin
Mannequin
More actions
I have added defined(__aarch64__) check to the if statement and tested the patch on arm64. The test passed.
So could you please also add the check for defined(__aarch64__) to the pull request so that it fixes bpo-29804 as well?
New changeset 2f3ba27 by Ned Deily (Miss Islington (bot)) in branch '3.6':
[3.6] bpo-30353: Fix pass by value for structs on 64-bit Cygwin/MinGW (GH-1559) (GH-5954) 2f3ba27
Activity
embray commentedon May 12, 2017
The test ctypes.test.test_structures.StructureTestCase.test_pass_by_value fails on 64-bit Cygwin and MinGW using the system libffi with:
======================================================================
FAIL: test_pass_by_value (ctypes.test.test_structures.StructureTestCase)
----------------------------------------------------------------------
It seems that libffi does not handle passing structs by value properly on those platforms as I explained here: libffi/libffi#305
The upstream bug hasn't been confirmed yet by the libffi developers so I could be wrong, but I think this is fairly clearly broken there.
I have a PR forthcoming to work around the issue.
zhangyangyu commentedon May 13, 2017
Looks same as bpo-29804.
embray commentedon May 15, 2017
Thanks for pointing that out. Indeed it's the same symptom, but slightly different cause. libffi has different implementations of its calling routines for different architectures/platforms depending on the machine architecture and calling conventions used. So this case is probably buggy for the arm64 implementation as well, as in bpo-29804.
Off the top of my head I don't know a reliable way to check for this case, but this fix would work around the arm64 issue as well if I could check for that architecture easily at compile time.
stratakis commentedon May 15, 2017
A 'defined(aarch64)' can be used for the arm64 arch. I will add it to your patch and test it on an arm64 machine to see if the test passes.
irushchyshyn commentedon May 16, 2017
I have added
defined(__aarch64__)check to the if statement and tested the patch on arm64. The test passed.So could you please also add the check for
defined(__aarch64__)to the pull request so that it fixes bpo-29804 as well?embray commentedon May 18, 2017
Sure, thanks for pointing that out.
embray commentedon May 23, 2017
Iryna, I updated the pull request with a slightly updated fix. Could you confirm again, when you get a chance, that it works for arm64? Thanks.
irushchyshyn commentedon May 24, 2017
Thank you, Erik. I have applied your new patch, and ran another build on arm64. The tests passed. Attaching the build log for more information.
embray commentedon May 24, 2017
Thanks for checking!
vsajip commentedon May 29, 2017
Patch LGTM now, perhaps others will concur?
vsajip commentedon Jun 7, 2017
New changeset 9ba3aa4 by Vinay Sajip (Erik Bray) in branch 'master':
bpo-30353: Fix pass by value for structs on 64-bit Cygwin/MinGW (GH-1559)
9ba3aa4
stratakis commentedon Jun 9, 2017
This bug affects also the 3.6 branch. Can the fix be backported?
embray commentedon Mar 8, 2018
This has a backport PR now for 3.6. Once that PR is merged I think we can close this as fixed.
ned-deily commentedon Mar 8, 2018
New changeset 2f3ba27 by Ned Deily (Miss Islington (bot)) in branch '3.6':
[3.6] bpo-30353: Fix pass by value for structs on 64-bit Cygwin/MinGW (GH-1559) (GH-5954)
2f3ba27