mirror of
https://github.com/python/cpython.git
synced 2025-12-31 12:33:28 +00:00
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> |
||
|---|---|---|
| .. | ||
| clinic | ||
| _ctypes.c | ||
| _ctypes_test.c | ||
| _ctypes_test.h | ||
| _ctypes_test_generated.c.h | ||
| callbacks.c | ||
| callproc.c | ||
| cfield.c | ||
| ctypes.h | ||
| malloc_closure.c | ||
| stgdict.c | ||