Skip to content

Commit eacc724

Browse files
Simplify POINTER
Co-authored-by: neonene <[email protected]>
1 parent 82f74ec commit eacc724

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

Lib/ctypes/__init__.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,6 @@ class c_bool(_SimpleCData):
266266

267267
from _ctypes import POINTER, pointer, _pointer_type_cache
268268

269-
_CType_Type = type(_Pointer).__base__
270-
271269
def POINTER(cls):
272270
if cls is None:
273271
return c_void_p
@@ -278,12 +276,8 @@ def POINTER(cls):
278276
except AttributeError:
279277
pass
280278
if isinstance(cls, str):
281-
return type(f'LP_{cls}', (_Pointer,), {})
282-
if isinstance(cls, _CType_Type):
283-
return type(f'LP_{cls.__name__}', (_Pointer,), {'_type_': cls})
284-
285-
raise TypeError(f'must be a ctypes-like type: {cls}')
286-
279+
return type(f'LP_{cls}', (_Pointer,), {}) # deprecated
280+
return type(f'LP_{cls.__name__}', (_Pointer,), {'_type_': cls})
287281
def pointer(arg):
288282
typ = POINTER(type(arg))
289283
return typ(arg)

0 commit comments

Comments
 (0)