Skip to content
7 changes: 7 additions & 0 deletions Doc/whatsnew/3.15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ Deprecated
Removed
=======

ctypes
------

* Removed the undocumented function :func:`!ctypes.SetPointerType`.
(Contributed by Bénédikt Tran in :gh:`133866`.)


sysconfig
---------

Expand Down
6 changes: 0 additions & 6 deletions Lib/ctypes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 3 additions & 6 deletions Lib/test/test_ctypes/test_incomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ class cell(Structure):
_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)

Expand All @@ -50,10 +48,9 @@ class cell(Structure):
_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()
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Remove the undocumented function :func:`!ctypes.SetPointerType`.
Patch by Bénédikt Tran.
Loading