Represents the C :c:expr:`PyObject *` datatype. Calling this without an
argument creates a ``NULL`` :c:expr:`PyObject *` pointer.
+ .. versionchanged:: next
+ :class:`!py_object` is now a :term:`generic type`.
+
The :mod:`!ctypes.wintypes` module provides quite some other Windows specific
data types, for example :c:type:`!HWND`, :c:type:`!WPARAM`, or :c:type:`!DWORD`.
Some useful structures like :c:type:`!MSG` or :c:type:`!RECT` are also defined.
loaded by the current process.
(Contributed by Brian Ward in :gh:`119349`.)
+* The :class:`ctypes.py_object` type now supports subscription,
+ making it a :term:`generic type`.
+ (Contributed by Brian Schubert in :gh:`132168`.)
+
+
datetime
--------
return super().__repr__()
except ValueError:
return "%s(<NULL>)" % type(self).__name__
+ __class_getitem__ = classmethod(_types.GenericAlias)
_check_size(py_object, "P")
class c_short(_SimpleCData):
DictReader, DictWriter,
array]
if ctypes is not None:
- generic_types.extend((ctypes.Array, ctypes.LibraryLoader))
+ generic_types.extend((ctypes.Array, ctypes.LibraryLoader, ctypes.py_object))
if ValueProxy is not None:
generic_types.extend((ValueProxy, DictProxy, ListProxy, ApplyResult,
MPSimpleQueue, MPQueue, MPJoinableQueue))
--- /dev/null
+The :class:`ctypes.py_object` type now supports subscription, making it a
+:term:`generic type`.