diff options
author | dura0ok <slpmcf@gmail.com> | 2025-04-22 20:13:00 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-22 16:13:00 +0300 |
commit | 3b4b56f46dbfc0c336a1f70704f127593ec1f4ce (patch) | |
tree | 8ced9e54b13dbd8f5534fefd8510af626ad7e672 /Tools/jit/jit.h | |
parent | f663b2c56a2eecc258d2abd54ed33836d070e6f5 (diff) | |
download | cpython-3b4b56f46dbfc0c336a1f70704f127593ec1f4ce.tar.gz cpython-3b4b56f46dbfc0c336a1f70704f127593ec1f4ce.zip |
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>
Diffstat (limited to 'Tools/jit/jit.h')
0 files changed, 0 insertions, 0 deletions