Skip to content

GH-97950: Use new-style index directive ('builtin') #104164

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
merged 6 commits into from
May 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/c-api/dict.rst
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ Dictionary Objects

.. c:function:: Py_ssize_t PyDict_Size(PyObject *p)

.. index:: builtin: len
.. index:: pair: built-in function; len

Return the number of items in the dictionary. This is equivalent to
``len(p)`` on a dictionary.
Expand Down
4 changes: 2 additions & 2 deletions Doc/c-api/import.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Importing Modules

.. c:function:: PyObject* PyImport_ImportModuleEx(const char *name, PyObject *globals, PyObject *locals, PyObject *fromlist)

.. index:: builtin: __import__
.. index:: pair: built-in function; __import__

Import a module. This is best described by referring to the built-in Python
function :func:`__import__`.
Expand Down Expand Up @@ -120,7 +120,7 @@ Importing Modules

.. c:function:: PyObject* PyImport_ExecCodeModule(const char *name, PyObject *co)

.. index:: builtin: compile
.. index:: pair: built-in function; compile

Given a module name (possibly of the form ``package.module``) and a code object
read from a Python bytecode file or obtained from the built-in function
Expand Down
4 changes: 2 additions & 2 deletions Doc/c-api/list.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ List Objects

.. c:function:: Py_ssize_t PyList_Size(PyObject *list)

.. index:: builtin: len
.. index:: pair: built-in function; len

Return the length of the list object in *list*; this is equivalent to
``len(list)`` on a list object.
Expand Down Expand Up @@ -138,7 +138,7 @@ List Objects

.. c:function:: PyObject* PyList_AsTuple(PyObject *list)

.. index:: builtin: tuple
.. index:: pair: built-in function; tuple

Return a new tuple object containing the contents of *list*; equivalent to
``tuple(list)``.
2 changes: 1 addition & 1 deletion Doc/c-api/mapping.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ See also :c:func:`PyObject_GetItem`, :c:func:`PyObject_SetItem` and
.. c:function:: Py_ssize_t PyMapping_Size(PyObject *o)
Py_ssize_t PyMapping_Length(PyObject *o)

.. index:: builtin: len
.. index:: pair: built-in function; len

Returns the number of keys in object *o* on success, and ``-1`` on failure.
This is equivalent to the Python expression ``len(o)``.
Expand Down
12 changes: 6 additions & 6 deletions Doc/c-api/number.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ Number Protocol

.. c:function:: PyObject* PyNumber_Divmod(PyObject *o1, PyObject *o2)

.. index:: builtin: divmod
.. index:: pair: built-in function; divmod

See the built-in function :func:`divmod`. Returns ``NULL`` on failure. This is
the equivalent of the Python expression ``divmod(o1, o2)``.


.. c:function:: PyObject* PyNumber_Power(PyObject *o1, PyObject *o2, PyObject *o3)

.. index:: builtin: pow
.. index:: pair: built-in function; pow

See the built-in function :func:`pow`. Returns ``NULL`` on failure. This is the
equivalent of the Python expression ``pow(o1, o2, o3)``, where *o3* is optional.
Expand All @@ -94,7 +94,7 @@ Number Protocol

.. c:function:: PyObject* PyNumber_Absolute(PyObject *o)

.. index:: builtin: abs
.. index:: pair: built-in function; abs

Returns the absolute value of *o*, or ``NULL`` on failure. This is the equivalent
of the Python expression ``abs(o)``.
Expand Down Expand Up @@ -192,7 +192,7 @@ Number Protocol

.. c:function:: PyObject* PyNumber_InPlacePower(PyObject *o1, PyObject *o2, PyObject *o3)

.. index:: builtin: pow
.. index:: pair: built-in function; pow

See the built-in function :func:`pow`. Returns ``NULL`` on failure. The operation
is done *in-place* when *o1* supports it. This is the equivalent of the Python
Expand Down Expand Up @@ -238,15 +238,15 @@ Number Protocol

.. c:function:: PyObject* PyNumber_Long(PyObject *o)

.. index:: builtin: int
.. index:: pair: built-in function; int

Returns the *o* converted to an integer object on success, or ``NULL`` on
failure. This is the equivalent of the Python expression ``int(o)``.


.. c:function:: PyObject* PyNumber_Float(PyObject *o)

.. index:: builtin: float
.. index:: pair: built-in function; float

Returns the *o* converted to a float object on success, or ``NULL`` on failure.
This is the equivalent of the Python expression ``float(o)``.
Expand Down
12 changes: 6 additions & 6 deletions Doc/c-api/object.rst
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ Object Protocol

.. c:function:: PyObject* PyObject_Repr(PyObject *o)

.. index:: builtin: repr
.. index:: pair: built-in function; repr

Compute a string representation of object *o*. Returns the string
representation on success, ``NULL`` on failure. This is the equivalent of the
Expand All @@ -202,7 +202,7 @@ Object Protocol

.. c:function:: PyObject* PyObject_ASCII(PyObject *o)

.. index:: builtin: ascii
.. index:: pair: built-in function; ascii

As :c:func:`PyObject_Repr`, compute a string representation of object *o*, but
escape the non-ASCII characters in the string returned by
Expand All @@ -227,7 +227,7 @@ Object Protocol

.. c:function:: PyObject* PyObject_Bytes(PyObject *o)

.. index:: builtin: bytes
.. index:: pair: built-in function; bytes

Compute a bytes representation of object *o*. ``NULL`` is returned on
failure and a bytes object on success. This is equivalent to the Python
Expand Down Expand Up @@ -278,7 +278,7 @@ Object Protocol

.. c:function:: Py_hash_t PyObject_Hash(PyObject *o)

.. index:: builtin: hash
.. index:: pair: built-in function; hash

Compute and return the hash value of an object *o*. On failure, return ``-1``.
This is the equivalent of the Python expression ``hash(o)``.
Expand Down Expand Up @@ -312,7 +312,7 @@ Object Protocol

.. c:function:: PyObject* PyObject_Type(PyObject *o)

.. index:: builtin: type
.. index:: pair: built-in function; type

When *o* is non-``NULL``, returns a type object corresponding to the object type
of object *o*. On failure, raises :exc:`SystemError` and returns ``NULL``. This
Expand All @@ -332,7 +332,7 @@ Object Protocol
.. c:function:: Py_ssize_t PyObject_Size(PyObject *o)
Py_ssize_t PyObject_Length(PyObject *o)

.. index:: builtin: len
.. index:: pair: built-in function; len

Return the length of object *o*. If the object *o* provides either the sequence
and mapping protocols, the sequence length is returned. On error, ``-1`` is
Expand Down
4 changes: 2 additions & 2 deletions Doc/c-api/sequence.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Sequence Protocol
.. c:function:: Py_ssize_t PySequence_Size(PyObject *o)
Py_ssize_t PySequence_Length(PyObject *o)

.. index:: builtin: len
.. index:: pair: built-in function; len

Returns the number of objects in sequence *o* on success, and ``-1`` on
failure. This is equivalent to the Python expression ``len(o)``.
Expand Down Expand Up @@ -120,7 +120,7 @@ Sequence Protocol

.. c:function:: PyObject* PySequence_Tuple(PyObject *o)

.. index:: builtin: tuple
.. index:: pair: built-in function; tuple

Return a tuple object with the same contents as the sequence or iterable *o*,
or ``NULL`` on failure. If *o* is a tuple, a new reference will be returned,
Expand Down
2 changes: 1 addition & 1 deletion Doc/c-api/set.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ or :class:`frozenset` or instances of their subtypes.

.. c:function:: Py_ssize_t PySet_Size(PyObject *anyset)

.. index:: builtin: len
.. index:: pair: built-in function; len

Return the length of a :class:`set` or :class:`frozenset` object. Equivalent to
``len(anyset)``. Raises a :exc:`PyExc_SystemError` if *anyset* is not a
Expand Down
4 changes: 2 additions & 2 deletions Doc/c-api/structures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ method.

.. data:: METH_CLASS

.. index:: builtin: classmethod
.. index:: pair: built-in function; classmethod

The method will be passed the type object as the first parameter rather
than an instance of the type. This is used to create *class methods*,
Expand All @@ -357,7 +357,7 @@ method.

.. data:: METH_STATIC

.. index:: builtin: staticmethod
.. index:: pair: built-in function; staticmethod

The method will be passed ``NULL`` as the first parameter rather than an
instance of the type. This is used to create *static methods*, similar to
Expand Down
4 changes: 2 additions & 2 deletions Doc/c-api/typeobj.rst
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ and :c:type:`PyType_Type` effectively act as defaults.)

.. c:member:: reprfunc PyTypeObject.tp_repr

.. index:: builtin: repr
.. index:: pair: built-in function; repr

An optional pointer to a function that implements the built-in function
:func:`repr`.
Expand Down Expand Up @@ -870,7 +870,7 @@ and :c:type:`PyType_Type` effectively act as defaults.)

.. c:member:: hashfunc PyTypeObject.tp_hash

.. index:: builtin: hash
.. index:: pair: built-in function; hash

An optional pointer to a function that implements the built-in function
:func:`hash`.
Expand Down
2 changes: 1 addition & 1 deletion Doc/extending/newtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ done. This can be done using the :c:func:`PyErr_Fetch` and

.. index::
single: string; object representation
builtin: repr
pair: built-in function; repr

Object Presentation
-------------------
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/dis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1367,7 +1367,7 @@ iterations of the loop.

.. opcode:: BUILD_SLICE (argc)

.. index:: builtin: slice
.. index:: pair: built-in function; slice

Pushes a slice object on the stack. *argc* must be 2 or 3. If it is 2, implements::

Expand Down
2 changes: 1 addition & 1 deletion Doc/library/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ are always available. They are listed here in alphabetical order.
Raises an :ref:`auditing event <auditing>` ``exec`` with the code object
as the argument. Code compilation events may also be raised.

.. index:: builtin: exec
.. index:: pair: built-in function; exec

.. function:: exec(object, globals=None, locals=None, /, *, closure=None)

Expand Down
4 changes: 2 additions & 2 deletions Doc/library/pprint.rst
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ The :mod:`pprint` module defines one class:

.. function:: isreadable(object)

.. index:: builtin: eval
.. index:: pair: built-in function; eval

Determine if the formatted representation of *object* is "readable", or can be
used to reconstruct the value using :func:`eval`. This always returns ``False``
Expand Down Expand Up @@ -218,7 +218,7 @@ created.

.. method:: PrettyPrinter.isreadable(object)

.. index:: builtin: eval
.. index:: pair: built-in function; eval

Determine if the formatted representation of the object is "readable," or can be
used to reconstruct the value using :func:`eval`. Note that this returns
Expand Down
24 changes: 12 additions & 12 deletions Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,9 @@ and imaginary parts.

.. index::
single: arithmetic
builtin: int
builtin: float
builtin: complex
pair: built-in function; int
pair: built-in function; float
pair: built-in function; complex
single: operator; + (plus)
single: + (plus); unary operator
single: + (plus); binary operator
Expand Down Expand Up @@ -945,9 +945,9 @@ operations have the same priority as the corresponding numeric operations. [3]_

.. index::
triple: operations on; sequence; types
builtin: len
builtin: min
builtin: max
pair: built-in function; len
pair: built-in function; min
pair: built-in function; max
pair: concatenation; operation
pair: repetition; operation
pair: subscript; operation
Expand Down Expand Up @@ -1113,7 +1113,7 @@ Immutable Sequence Types
.. index::
triple: immutable; sequence; types
pair: object; tuple
builtin: hash
pair: built-in function; hash

The only operation that immutable sequence types generally implement that is
not also implemented by mutable sequence types is support for the :func:`hash`
Expand Down Expand Up @@ -4419,7 +4419,7 @@ Mapping Types --- :class:`dict`
triple: operations on; mapping; types
triple: operations on; dictionary; type
pair: statement; del
builtin: len
pair: built-in function; len

A :term:`mapping` object maps :term:`hashable` values to arbitrary objects.
Mappings are mutable objects. There is currently only one standard mapping
Expand Down Expand Up @@ -5348,7 +5348,7 @@ Code Objects
------------

.. index::
builtin: compile
pair: built-in function; compile
single: __code__ (function object attribute)

Code objects are used by the implementation to represent "pseudo-compiled"
Expand All @@ -5362,8 +5362,8 @@ Accessing ``__code__`` raises an :ref:`auditing event <auditing>`
``object.__getattr__`` with arguments ``obj`` and ``"__code__"``.

.. index::
builtin: exec
builtin: eval
pair: built-in function; exec
pair: built-in function; eval

A code object can be executed or evaluated by passing it (instead of a source
string) to the :func:`exec` or :func:`eval` built-in functions.
Expand All @@ -5377,7 +5377,7 @@ Type Objects
------------

.. index::
builtin: type
pair: built-in function; type
pair: module; types

Type objects represent the various object types. An object's type is accessed
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ Standard names are defined for the following types:

.. class:: CodeType(**kwargs)

.. index:: builtin: compile
.. index:: pair: built-in function; compile

The type for code objects such as returned by :func:`compile`.

Expand Down
2 changes: 1 addition & 1 deletion Doc/reference/compound_stmts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ those made in the suite of the for-loop::


.. index::
builtin: range
pair: built-in function; range

Names in the target list are not deleted when the loop is finished, but if the
sequence is empty, they will not have been assigned to at all by the loop. Hint:
Expand Down
Loading