Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_ctypes test_pass_by_value fails on arm64 (aarch64) architecture #73990

Closed
irushchyshyn mannequin opened this issue Mar 13, 2017 · 15 comments
Closed

test_ctypes test_pass_by_value fails on arm64 (aarch64) architecture #73990

irushchyshyn mannequin opened this issue Mar 13, 2017 · 15 comments
Labels
3.7 (EOL) end of life tests Tests in the Lib/test dir topic-ctypes

Comments

@irushchyshyn
Copy link
Mannequin

irushchyshyn mannequin commented Mar 13, 2017

BPO 29804
Nosy @vsajip, @vstinner, @ned-deily, @yan12125, @stratakis, @irushchyshyn
PRs
  • bpo-30353 Fix pass by value for structs on 64-bit Cygwin/MinGW #1559
  • Files
  • Python3.6.1rc1_build_log.txt
  • 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 = None
    closed_at = <Date 2018-03-11.22:20:58.714>
    created_at = <Date 2017-03-13.13:50:54.061>
    labels = ['ctypes', '3.7', 'tests']
    title = 'test_ctypes test_pass_by_value fails on arm64 (aarch64) architecture'
    updated_at = <Date 2018-08-02.14:49:59.565>
    user = 'https://github.com/irushchyshyn'

    bugs.python.org fields:

    activity = <Date 2018-08-02.14:49:59.565>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-03-11.22:20:58.714>
    closer = 'ned.deily'
    components = ['Tests', 'ctypes']
    creation = <Date 2017-03-13.13:50:54.061>
    creator = 'ishcherb'
    dependencies = []
    files = ['46724']
    hgrepos = []
    issue_num = 29804
    keywords = []
    message_count = 15.0
    messages = ['289539', '289589', '289595', '289669', '289670', '289674', '290065', '312200', '312963', '312964', '312982', '313625', '322956', '322964', '322966']
    nosy_count = 6.0
    nosy_names = ['vinay.sajip', 'vstinner', 'ned.deily', 'yan12125', 'cstratak', 'ishcherb']
    pr_nums = ['1559']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue29804'
    versions = ['Python 3.6', 'Python 3.7']

    @irushchyshyn
    Copy link
    Mannequin Author

    irushchyshyn mannequin commented Mar 13, 2017

    I am trying to build Python 3.6.1rc1 on Fedora, and have the following test failing on arm64 (aarch64) architecture:

    ======================================================================
    FAIL: test_pass_by_value (ctypes.test.test_structures.StructureTestCase)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/builddir/build/BUILD/Python-3.6.1rc1/Lib/ctypes/test/test_structures.py", line 413, in test_pass_by_value
        self.assertEqual(s.first, 0xdeadbeef)
    AssertionError: 195948557 != 3735928559

    The build log is attached.
    The test was added in this commit [1] as a fix for bpo-29565.

    Any idea what this can be related to?

    [1] 3cc5817

    @irushchyshyn irushchyshyn mannequin added tests Tests in the Lib/test dir topic-ctypes labels Mar 13, 2017
    @irushchyshyn
    Copy link
    Mannequin Author

    irushchyshyn mannequin commented Mar 14, 2017

    Hi Vinay, I have added you to the nosy list as you are the author of the fix for bpo-29565, and would like to ask you for insights or ideas on why the test would fail only on one architecture (arm64)?

    @vsajip
    Copy link
    Member

    vsajip commented Mar 14, 2017

    The test checks that a structure passed by value is indeed passed by value - something that is architecture-dependent, as calling conventions differ across architectures.

    If the test fails, this indicates that the structure isn't being passed by value - a pointer to the structure is probably passed, which is pass-by-reference rather than pass-by-value. This indicates that a change to ctypes or libffi is needed to fix this. See the changes made in Modules/_ctypes/libffi_msvc/ffi.c for bpo-29565 - probably, analogous changes need to be made to the corresponding code for arm64.

    @stratakis
    Copy link
    Mannequin

    stratakis mannequin commented Mar 15, 2017

    Since this newly added assertion [0] fails for aarch64 shouldn't this be considered a regression?

    And taking into account the timeframe, a release blocker for 3.6.1?

    @stratakis
    Copy link
    Mannequin

    stratakis mannequin commented Mar 15, 2017

    @vsajip
    Copy link
    Member

    vsajip commented Mar 15, 2017

    I don't think it's a regression. It's catching an error that was there, but wasn't tested for before.

    If it should be a release blocker - that should not be for any reversion of the change to the test, but for implementing the pass-by-value functionality correctly.

    @ned-deily
    Copy link
    Member

    Technically speaking, we do not officially support arm64 in our release process as we have no arm64 buildbots nor an identified core developer for the platform; see PEP-11 for the policy details. So there is no place to test a fix if there was one identified. That said, it would be good to fix the problem if someone is willing to provide a fix and test it or determine that the issue here is a libffi problem. It would be even better if we could make arm64 an officially supported platform as outlined.

    @irushchyshyn
    Copy link
    Mannequin Author

    irushchyshyn mannequin commented Feb 15, 2018

    PR 1559 fixes the issue in Fedora builds on arm64. The issue is no longer reproducible with Python 3.7.

    @ned-deily
    Copy link
    Member

    Vinay, should this backported to 3.6? Otherwise, can the issue be closed?

    @ned-deily ned-deily added the 3.7 (EOL) end of life label Feb 26, 2018
    @stratakis
    Copy link
    Mannequin

    stratakis mannequin commented Feb 26, 2018

    The bug is still present on the 3.6 branch.

    @vsajip
    Copy link
    Member

    vsajip commented Feb 27, 2018

    Vinay, should this back-ported to 3.6?

    Yes, I think it should be.

    @ned-deily
    Copy link
    Member

    OK, PR 1559 (in 3.7.0) for bpo-30353 has been backported to 3.6 in PR 5954 for release in 3.6.5. So based on msg312200, I'm going to assume the problem is no longer reproducible in 3.6 and close this issue. If not, please reopen.

    @vstinner
    Copy link
    Member

    vstinner commented Aug 2, 2018

    This issue is mentioned from https://bugzilla.redhat.com/show_bug.cgi?id=1336557 but it seems like the bug has not been fixed in Python 2.7.

    I created PR 8625 to backport the fix to Python 2.7.

    @vstinner
    Copy link
    Member

    vstinner commented Aug 2, 2018

    New changeset 3243f8c by Victor Stinner in branch '2.7':
    bpo-29565: Corrected ctypes passing of large structs by value on Windows AMD64 (GH-168) (GH-8625)
    3243f8c

    @vstinner
    Copy link
    Member

    vstinner commented Aug 2, 2018

    I backported commit a86339b from master: commit 3243f8c, but I don't have access to arm64, so I cannot test if the backport fixes test_ctypes on arm64.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life tests Tests in the Lib/test dir topic-ctypes
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants