]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-142966: Make ctypes.POINTER.set_type also reset format (GH-142967)
authorJeong, YunWon <69878+youknowone@users.noreply.github.com>
Mon, 26 Jan 2026 16:40:56 +0000 (01:40 +0900)
committerGitHub <noreply@github.com>
Mon, 26 Jan 2026 16:40:56 +0000 (17:40 +0100)
commit9181d776daf87f0e4e2ce02c08f162150fdf7d79
treefc1c2cdce5065dceb72e61194aa07bdc79233df9
parent933540e33217474abee3e1b53dec28ad927b6311
gh-142966: Make ctypes.POINTER.set_type also reset format (GH-142967)

Make the deprecated set_type method resets the format, using the
same code as in type initialization.

Implementation note: this was done in PyCPointerType_init
after calling PyCPointerType_SetProto, but was forgotten
after in PyCPointerType_set_type_impl's call to
PyCPointerType_SetProto.
With this change, setting the format is conceptually part of
setting proto (i.e. the pointed-to type).

Co-authored-by: AN Long <aisk@users.noreply.github.com>
Lib/test/test_ctypes/test_incomplete.py
Misc/NEWS.d/next/Library/2025-12-19-11-30-31.gh-issue-142966.PzGiv2.rst [new file with mode: 0644]
Modules/_ctypes/_ctypes.c