Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gh-133866: remove deprecated and undocumented function ctypes.SetPointerType #133869

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
8 changes: 8 additions & 0 deletions Doc/whatsnew/3.15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,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
-----------

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,3 @@
Remove the undocumented function :func:`!ctypes.SetPointerType`,
which has been deprecated since Python 3.13.
Patch by BΓ©nΓ©dikt Tran.
Loading