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_generated_data() fails on x86 Debian Installed with X 3.x #121938

Open
vstinner opened this issue Jul 17, 2024 · 7 comments
Open
Assignees
Labels
tests Tests in the Lib/test dir topic-ctypes type-bug An unexpected behavior, bug, or error

Comments

@vstinner
Copy link
Member

vstinner commented Jul 17, 2024

Bug report

x86 Debian Installed with X 3.x build: https://buildbot.python.org/all/#/builders/1244/builds/2499

FAIL: test_generated_data (test.test_ctypes.test_generated_structs.GeneratedTest.test_generated_data) (name='Packed4')
Check that a ctypes struct/union matches its C equivalent.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/buildbot/buildarea/3.x.ware-debian-x86.installed/build/target/lib/python3.14/test/test_ctypes/test_generated_structs.py", line 444, in test_generated_data
    self.assertEqual(sizeof(cls), next(expected))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 12 != 16

The structure:

@register()
class Packed4(Structure):
    _fields_ = [('a', c_int8), ('b', c_int64)]
    _pack_ = 8

configure:

./configure --prefix '$(PWD)/target'

test.pythoninfo:

CC.version: gcc (Debian 12.2.0-14) 12.2.0

sysconfig[CFLAGS]: -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall

sysconfig[PY_CFLAGS]: -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall

sysconfig[PY_CFLAGS_NODIST]: -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -I./Include/internal -I./Include/internal/mimalloc

sysconfig[PY_STDMODULE_CFLAGS]: -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -I./Include/internal -I./Include/internal/mimalloc -I. -I./Include

Linked PRs

@vstinner vstinner added type-bug An unexpected behavior, bug, or error tests Tests in the Lib/test dir labels Jul 17, 2024
@vstinner
Copy link
Member Author

vstinner commented Aug 5, 2024

cc @zware

@zware
Copy link
Member

zware commented Aug 5, 2024

According to git bisect, this is due to 18c1a8d

@vstinner
Copy link
Member Author

vstinner commented Aug 6, 2024

cc @gpshead @encukou who authored the change introducing the regression.

@hroncok
Copy link
Contributor

hroncok commented Oct 16, 2024

We see this on Fedora i686 as well.

@mcepl
Copy link
Contributor

mcepl commented Oct 17, 2024

Yes, the same on openSUSE with 3.14.0~a1. Works on x86_64, but breaks on 32bit i586.

Complete build log.

@encukou encukou self-assigned this Oct 18, 2024
@encukou
Copy link
Member

encukou commented Oct 18, 2024

I'll fix it by alpha 2

encukou added a commit to encukou/cpython that referenced this issue Oct 23, 2024
…n x86

The current auto-generated tests don't cover this; it's instead
tested manually.
@encukou
Copy link
Member

encukou commented Oct 23, 2024

Took a while, but I'm now convinced that skipping this test is the correct thing to do.

The test code to generate an C struct equivalent to a ctypes struct is far from perfect.

zware pushed a commit that referenced this issue Oct 23, 2024
…H-125877)

The current auto-generated tests don't cover this; it's instead
tested manually.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir topic-ctypes type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

5 participants