cpython/Modules/_ctypes
Peter Bierma ca0cdf42cf
[3.13] gh-156933: Widen narrow integer results in ctypes callbacks (GH-157045) (GH-158297)
_CallPythonObject() only wrote restype->size bytes into the closure's result buffer, leaving the unused high-order bits of the ffi_arg-sized register untouched. libffi's ffi_prep_closure_loc() documents that integral types narrower than a machine register must be widened to fill it, sign-extending signed types. On architectures that always read the full register for narrow return values (s390x), this leaves garbage in the high bits, which broke libclang callbacks used by cindex.py.

(cherry picked from commit b6f9a50e65)

Co-authored-by: Lazizbek Ergashev <lazerg2@gmail.com>
2026-09-27 19:04:34 +00:00
..
clinic
_ctypes.c [3.13] gh-151126: Fix PyErr_NoMemory errors in _ctypes.c (GH-152720) (#153708) 2026-08-04 10:57:32 +02:00
_ctypes_test.c [3.13] gh-156933: Widen narrow integer results in ctypes callbacks (GH-157045) (GH-158297) 2026-09-27 19:04:34 +00:00
_ctypes_test.h
callbacks.c [3.13] gh-156933: Widen narrow integer results in ctypes callbacks (GH-157045) (GH-158297) 2026-09-27 19:04:34 +00:00
callproc.c [3.13] gh-151126: Fix crash on unset memory error in ctypes.get_errno (GH-151382) (#151400) 2026-06-12 11:27:19 +00:00
cfield.c gh-117142: Port _ctypes to multi-phase init (GH-117181) 2024-04-10 11:00:01 +00:00
ctypes.h
malloc_closure.c gh-108765: Python.h no longer includes <unistd.h> (#108783) 2023-09-02 16:50:18 +02:00
stgdict.c [3.13] gh-132673: Fix a crash with zero-alignment in ctypes.Structure (#132695) 2025-04-19 14:29:05 +00:00