mirror of
https://github.com/python/cpython.git
synced 2026-05-08 11:31:13 +00:00
Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com> Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
35 lines
1.2 KiB
ReStructuredText
35 lines
1.2 KiB
ReStructuredText
.. highlight:: c
|
|
|
|
.. _sentinelobjects:
|
|
|
|
Sentinel objects
|
|
----------------
|
|
|
|
.. c:var:: PyTypeObject PySentinel_Type
|
|
|
|
This instance of :c:type:`PyTypeObject` represents the Python
|
|
:class:`sentinel` type. This is the same object as :class:`sentinel`.
|
|
|
|
.. versionadded:: next
|
|
|
|
.. c:function:: int PySentinel_Check(PyObject *o)
|
|
|
|
Return true if *o* is a :class:`sentinel` object. The :class:`sentinel` type
|
|
does not allow subclasses, so this check is exact.
|
|
|
|
.. versionadded:: next
|
|
|
|
.. c:function:: PyObject* PySentinel_New(const char *name, const char *module_name)
|
|
|
|
Return a new :class:`sentinel` object with :attr:`~sentinel.__name__` set to
|
|
*name* and :attr:`~sentinel.__module__` set to *module_name*.
|
|
*name* must not be ``NULL``. If *module_name* is ``NULL``, :attr:`~sentinel.__module__`
|
|
is set to ``None``.
|
|
Return ``NULL`` with an exception set on failure.
|
|
|
|
For pickling to work, *module_name* must be the name of an importable
|
|
module, and the sentinel must be accessible from that module under a
|
|
path matching *name*. Pickle treats *name* as a global variable name
|
|
in *module_name* (see :meth:`object.__reduce__`).
|
|
|
|
.. versionadded:: next
|