cpython/Misc/NEWS.d/next/C_API
dura0ok 3b4b56f46d
gh-132470: Prevent crash in ctypes.CField when byte_size is incorrect (#132475)
Fix: Prevent crash in ctypes.CField when byte_size does not match type size  (gh-132470)

When creating a ctypes.CField with an incorrect byte_size (e.g., using `byte_size=2` for `ctypes.c_byte`), the code would previously abort due to the failed assertion `byte_size == info->size`.

This commit replaces the assertion with a proper error handling mechanism that raises a `ValueError` when `byte_size` does not match the expected type size. This prevents the crash and provides a more informative error message to the us

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-04-22 16:13:00 +03:00
..
2024-12-31-15-28-14.gh-issue-50333.KxQUXa.rst gh-50333: Deprecate support of non-tuple sequences in PyArg_ParseTuple() (GH-128374) 2025-04-08 14:26:32 +03:00
2025-01-08-18-55-57.gh-issue-112068.ofI5Fl.rst gh-112068: C API: Add support of nullable arguments in PyArg_Parse (GH-121303) 2025-04-08 22:08:00 +03:00
2025-04-13-20-52-39.gh-issue-132470.UqBQjN.rst gh-132470: Prevent crash in ctypes.CField when byte_size is incorrect (#132475) 2025-04-22 16:13:00 +03:00
README.rst Move NEWS entries out of directories with spaces (GH-127067) 2024-11-20 18:52:46 +00:00

Put news entry `blurb`_ files for the *C API* section in this directory.

.. _blurb: https://pypi.org/project/blurb/