Skip to content

[3.13] gh-156933: Widen narrow integer results in ctypes callbacks (GH-157045) - #158297

Merged
ZeroIntensity merged 1 commit into
python:3.13from
ZeroIntensity:backport-b6f9a50-3.13
Sep 27, 2026
Merged

ZeroIntensity merged 1 commit into
python:3.13from
ZeroIntensity:backport-b6f9a50-3.13

Conversation

@ZeroIntensity

@ZeroIntensity ZeroIntensity commented Sep 27, 2026 •

Copy link
Copy Markdown
Member

…backs (pythonGH-157045)

_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 b6f9a50)

Co-authored-by: Lazizbek Ergashev <lazerg2@gmail.com>
@ZeroIntensity
ZeroIntensity enabled auto-merge (squash) September 27, 2026 18:43
@ZeroIntensity
ZeroIntensity merged commit ca0cdf4 into python:3.13 Sep 27, 2026
44 checks passed
@ZeroIntensity
ZeroIntensity deleted the backport-b6f9a50-3.13 branch September 27, 2026 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants