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>
D
dura0ok committed
3b4b56f46dbfc0c336a1f70704f127593ec1f4ce
Parent: f663b2c
Committed by GitHub <noreply@github.com>
on 4/22/2025, 1:13:00 PM