gh-133866: remove deprecated and undocumented function ctypes.SetPointerType (GH-133869)

This commit is contained in:
Bénédikt Tran 2025-05-29 15:28:57 +02:00 committed by GitHub
parent b783e1791b
commit cafbcd666a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 14 additions and 12 deletions

View file

@ -138,6 +138,14 @@ Deprecated
Removed
=======
ctypes
------
* Removed the undocumented function :func:`!ctypes.SetPointerType`,
which has been deprecated since Python 3.13.
(Contributed by Bénédikt Tran in :gh:`133866`.)
http.server
-----------

View file

@ -379,12 +379,6 @@ def create_unicode_buffer(init, size=None):
return buf
raise TypeError(init)
def SetPointerType(pointer, cls):
import warnings
warnings._deprecated("ctypes.SetPointerType", remove=(3, 15))
pointer.set_type(cls)
def ARRAY(typ, len):
return typ * len

View file

@ -21,9 +21,7 @@ class TestSetPointerType(unittest.TestCase):
_fields_ = [("name", c_char_p),
("next", lpcell)]
with warnings.catch_warnings():
warnings.simplefilter('ignore', DeprecationWarning)
ctypes.SetPointerType(lpcell, cell)
lpcell.set_type(cell)
self.assertIs(POINTER(cell), lpcell)
@ -50,10 +48,9 @@ class TestSetPointerType(unittest.TestCase):
_fields_ = [("name", c_char_p),
("next", lpcell)]
with self.assertWarns(DeprecationWarning):
ctypes.SetPointerType(lpcell, cell)
lpcell.set_type(cell)
self.assertIs(POINTER(cell), lpcell)
if __name__ == '__main__':
unittest.main()

View file

@ -0,0 +1,3 @@
Remove the undocumented function :func:`!ctypes.SetPointerType`,
which has been deprecated since Python 3.13.
Patch by Bénédikt Tran.