mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
gh-133866: remove deprecated and undocumented function ctypes.SetPointerType
(GH-133869)
This commit is contained in:
parent
b783e1791b
commit
cafbcd666a
4 changed files with 14 additions and 12 deletions
|
@ -138,6 +138,14 @@ Deprecated
|
||||||
Removed
|
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
|
http.server
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
|
|
|
@ -379,12 +379,6 @@ def create_unicode_buffer(init, size=None):
|
||||||
return buf
|
return buf
|
||||||
raise TypeError(init)
|
raise TypeError(init)
|
||||||
|
|
||||||
|
|
||||||
def SetPointerType(pointer, cls):
|
|
||||||
import warnings
|
|
||||||
warnings._deprecated("ctypes.SetPointerType", remove=(3, 15))
|
|
||||||
pointer.set_type(cls)
|
|
||||||
|
|
||||||
def ARRAY(typ, len):
|
def ARRAY(typ, len):
|
||||||
return typ * len
|
return typ * len
|
||||||
|
|
||||||
|
|
|
@ -21,9 +21,7 @@ class TestSetPointerType(unittest.TestCase):
|
||||||
_fields_ = [("name", c_char_p),
|
_fields_ = [("name", c_char_p),
|
||||||
("next", lpcell)]
|
("next", lpcell)]
|
||||||
|
|
||||||
with warnings.catch_warnings():
|
lpcell.set_type(cell)
|
||||||
warnings.simplefilter('ignore', DeprecationWarning)
|
|
||||||
ctypes.SetPointerType(lpcell, cell)
|
|
||||||
|
|
||||||
self.assertIs(POINTER(cell), lpcell)
|
self.assertIs(POINTER(cell), lpcell)
|
||||||
|
|
||||||
|
@ -50,10 +48,9 @@ class TestSetPointerType(unittest.TestCase):
|
||||||
_fields_ = [("name", c_char_p),
|
_fields_ = [("name", c_char_p),
|
||||||
("next", lpcell)]
|
("next", lpcell)]
|
||||||
|
|
||||||
with self.assertWarns(DeprecationWarning):
|
lpcell.set_type(cell)
|
||||||
ctypes.SetPointerType(lpcell, cell)
|
|
||||||
|
|
||||||
self.assertIs(POINTER(cell), lpcell)
|
self.assertIs(POINTER(cell), lpcell)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
@ -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…
Add table
Add a link
Reference in a new issue