-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
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
ctypes: structure with bitfields as argument #60780
Comments
ctypes pretends to support passing arguments to C functions that are structures containing bitfields, or at least does not explicitly forbid it. But doing so results in misbehavior or segfaults in libffi itself. Indeed, libffi has no support for this, and ctypes just describes a field like "int x:1;" as "int x;". The attached example segfaults on Linux x86-64. |
The same misbehavior occurs if the structures are packed ("_pack_ = 1"). Attached in test186_lib.tgz. |
I propose to start with the attached documentation fix (generated vs. 3.2 but should be applied to all active branches). A code fix has to be discussed more thoroughly because in theory some code running only on x86-32 can rely on it and will break. |
The patch addresses bpo-16575 as well |
New changeset 0acd9408b6f1 by Eli Bendersky in branch '3.2': New changeset bfc159f8e4b4 by Eli Bendersky in branch '3.3': New changeset 502624235c7b by Eli Bendersky in branch 'default': |
New changeset eece32440a52 by Eli Bendersky in branch '2.7': |
The issue is being reopened, see this comment on bpo-16575: |
Linking for convenience: #60779 (comment) |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: