]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-111178: fix UBSan failures in `Modules/_ctypes` (#129071)
authorBénédikt Tran <10796600+picnixz@users.noreply.github.com>
Tue, 21 Jan 2025 10:50:13 +0000 (11:50 +0100)
committerGitHub <noreply@github.com>
Tue, 21 Jan 2025 10:50:13 +0000 (11:50 +0100)
commitfafc618e2f535dc972f9502d8547e089d4c7908d
tree8c89d4151654c6b7ec9cb8e0c689e9612bfc35e5
parent36f341ca3ecd5f0d54073c6dbfa82b95d843cab8
gh-111178: fix UBSan failures in `Modules/_ctypes` (#129071)

This fixes UBSan failures for the following objects:

- `DictRemoverObject` and `StructParamObject`,
- `CDataObject` and `CFieldObject`, and
- `PyCFuncPtrObject` and `PyCArgObject`.

On the default build, we convert the `LOCK_PTR` and `UNLOCK_PTR` macros to
functions with an unused parameter to ease "unused variable" compiler warnings
suppression. Finally, we also remove some redundant casts to `PyObject *`.
Modules/_ctypes/_ctypes.c
Modules/_ctypes/callproc.c
Modules/_ctypes/cfield.c
Modules/_ctypes/ctypes.h