Skip to content

Commit f508800

Browse files
authored
GH-97950: Use new-style index directive ('builtin') (#104164)
* Uncomment builtin removal in pairindextypes * Use new-style index directive ('builtin') - C API * Use new-style index directive ('builtin') - Extending * Use new-style index directive ('builtin') - Library * Use new-style index directive ('builtin') - Reference * Use new-style index directive ('builtin') - Tutorial
1 parent 4cd95dc commit f508800

23 files changed

+77
-77
lines changed

Doc/c-api/dict.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ Dictionary Objects
154154
155155
.. c:function:: Py_ssize_t PyDict_Size(PyObject *p)
156156
157-
.. index:: builtin: len
157+
.. index:: pair: built-in function; len
158158
159159
Return the number of items in the dictionary. This is equivalent to
160160
``len(p)`` on a dictionary.

Doc/c-api/import.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Importing Modules
4141
4242
.. c:function:: PyObject* PyImport_ImportModuleEx(const char *name, PyObject *globals, PyObject *locals, PyObject *fromlist)
4343
44-
.. index:: builtin: __import__
44+
.. index:: pair: built-in function; __import__
4545
4646
Import a module. This is best described by referring to the built-in Python
4747
function :func:`__import__`.
@@ -120,7 +120,7 @@ Importing Modules
120120
121121
.. c:function:: PyObject* PyImport_ExecCodeModule(const char *name, PyObject *co)
122122
123-
.. index:: builtin: compile
123+
.. index:: pair: built-in function; compile
124124
125125
Given a module name (possibly of the form ``package.module``) and a code object
126126
read from a Python bytecode file or obtained from the built-in function

Doc/c-api/list.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ List Objects
4545
4646
.. c:function:: Py_ssize_t PyList_Size(PyObject *list)
4747
48-
.. index:: builtin: len
48+
.. index:: pair: built-in function; len
4949
5050
Return the length of the list object in *list*; this is equivalent to
5151
``len(list)`` on a list object.
@@ -138,7 +138,7 @@ List Objects
138138
139139
.. c:function:: PyObject* PyList_AsTuple(PyObject *list)
140140
141-
.. index:: builtin: tuple
141+
.. index:: pair: built-in function; tuple
142142
143143
Return a new tuple object containing the contents of *list*; equivalent to
144144
``tuple(list)``.

Doc/c-api/mapping.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ See also :c:func:`PyObject_GetItem`, :c:func:`PyObject_SetItem` and
2020
.. c:function:: Py_ssize_t PyMapping_Size(PyObject *o)
2121
Py_ssize_t PyMapping_Length(PyObject *o)
2222
23-
.. index:: builtin: len
23+
.. index:: pair: built-in function; len
2424
2525
Returns the number of keys in object *o* on success, and ``-1`` on failure.
2626
This is equivalent to the Python expression ``len(o)``.

Doc/c-api/number.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ Number Protocol
6464
6565
.. c:function:: PyObject* PyNumber_Divmod(PyObject *o1, PyObject *o2)
6666
67-
.. index:: builtin: divmod
67+
.. index:: pair: built-in function; divmod
6868
6969
See the built-in function :func:`divmod`. Returns ``NULL`` on failure. This is
7070
the equivalent of the Python expression ``divmod(o1, o2)``.
7171
7272
7373
.. c:function:: PyObject* PyNumber_Power(PyObject *o1, PyObject *o2, PyObject *o3)
7474
75-
.. index:: builtin: pow
75+
.. index:: pair: built-in function; pow
7676
7777
See the built-in function :func:`pow`. Returns ``NULL`` on failure. This is the
7878
equivalent of the Python expression ``pow(o1, o2, o3)``, where *o3* is optional.
@@ -94,7 +94,7 @@ Number Protocol
9494
9595
.. c:function:: PyObject* PyNumber_Absolute(PyObject *o)
9696
97-
.. index:: builtin: abs
97+
.. index:: pair: built-in function; abs
9898
9999
Returns the absolute value of *o*, or ``NULL`` on failure. This is the equivalent
100100
of the Python expression ``abs(o)``.
@@ -192,7 +192,7 @@ Number Protocol
192192
193193
.. c:function:: PyObject* PyNumber_InPlacePower(PyObject *o1, PyObject *o2, PyObject *o3)
194194
195-
.. index:: builtin: pow
195+
.. index:: pair: built-in function; pow
196196
197197
See the built-in function :func:`pow`. Returns ``NULL`` on failure. The operation
198198
is done *in-place* when *o1* supports it. This is the equivalent of the Python
@@ -238,15 +238,15 @@ Number Protocol
238238
239239
.. c:function:: PyObject* PyNumber_Long(PyObject *o)
240240
241-
.. index:: builtin: int
241+
.. index:: pair: built-in function; int
242242
243243
Returns the *o* converted to an integer object on success, or ``NULL`` on
244244
failure. This is the equivalent of the Python expression ``int(o)``.
245245
246246
247247
.. c:function:: PyObject* PyNumber_Float(PyObject *o)
248248
249-
.. index:: builtin: float
249+
.. index:: pair: built-in function; float
250250
251251
Returns the *o* converted to a float object on success, or ``NULL`` on failure.
252252
This is the equivalent of the Python expression ``float(o)``.

Doc/c-api/object.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ Object Protocol
190190
191191
.. c:function:: PyObject* PyObject_Repr(PyObject *o)
192192
193-
.. index:: builtin: repr
193+
.. index:: pair: built-in function; repr
194194
195195
Compute a string representation of object *o*. Returns the string
196196
representation on success, ``NULL`` on failure. This is the equivalent of the
@@ -202,7 +202,7 @@ Object Protocol
202202
203203
.. c:function:: PyObject* PyObject_ASCII(PyObject *o)
204204
205-
.. index:: builtin: ascii
205+
.. index:: pair: built-in function; ascii
206206
207207
As :c:func:`PyObject_Repr`, compute a string representation of object *o*, but
208208
escape the non-ASCII characters in the string returned by
@@ -227,7 +227,7 @@ Object Protocol
227227
228228
.. c:function:: PyObject* PyObject_Bytes(PyObject *o)
229229
230-
.. index:: builtin: bytes
230+
.. index:: pair: built-in function; bytes
231231
232232
Compute a bytes representation of object *o*. ``NULL`` is returned on
233233
failure and a bytes object on success. This is equivalent to the Python
@@ -278,7 +278,7 @@ Object Protocol
278278
279279
.. c:function:: Py_hash_t PyObject_Hash(PyObject *o)
280280
281-
.. index:: builtin: hash
281+
.. index:: pair: built-in function; hash
282282
283283
Compute and return the hash value of an object *o*. On failure, return ``-1``.
284284
This is the equivalent of the Python expression ``hash(o)``.
@@ -312,7 +312,7 @@ Object Protocol
312312
313313
.. c:function:: PyObject* PyObject_Type(PyObject *o)
314314
315-
.. index:: builtin: type
315+
.. index:: pair: built-in function; type
316316
317317
When *o* is non-``NULL``, returns a type object corresponding to the object type
318318
of object *o*. On failure, raises :exc:`SystemError` and returns ``NULL``. This
@@ -332,7 +332,7 @@ Object Protocol
332332
.. c:function:: Py_ssize_t PyObject_Size(PyObject *o)
333333
Py_ssize_t PyObject_Length(PyObject *o)
334334
335-
.. index:: builtin: len
335+
.. index:: pair: built-in function; len
336336
337337
Return the length of object *o*. If the object *o* provides either the sequence
338338
and mapping protocols, the sequence length is returned. On error, ``-1`` is

Doc/c-api/sequence.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Sequence Protocol
1818
.. c:function:: Py_ssize_t PySequence_Size(PyObject *o)
1919
Py_ssize_t PySequence_Length(PyObject *o)
2020
21-
.. index:: builtin: len
21+
.. index:: pair: built-in function; len
2222
2323
Returns the number of objects in sequence *o* on success, and ``-1`` on
2424
failure. This is equivalent to the Python expression ``len(o)``.
@@ -120,7 +120,7 @@ Sequence Protocol
120120
121121
.. c:function:: PyObject* PySequence_Tuple(PyObject *o)
122122
123-
.. index:: builtin: tuple
123+
.. index:: pair: built-in function; tuple
124124
125125
Return a tuple object with the same contents as the sequence or iterable *o*,
126126
or ``NULL`` on failure. If *o* is a tuple, a new reference will be returned,

Doc/c-api/set.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ or :class:`frozenset` or instances of their subtypes.
107107
108108
.. c:function:: Py_ssize_t PySet_Size(PyObject *anyset)
109109
110-
.. index:: builtin: len
110+
.. index:: pair: built-in function; len
111111
112112
Return the length of a :class:`set` or :class:`frozenset` object. Equivalent to
113113
``len(anyset)``. Raises a :exc:`PyExc_SystemError` if *anyset* is not a

Doc/c-api/structures.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ method.
347347
348348
.. data:: METH_CLASS
349349
350-
.. index:: builtin: classmethod
350+
.. index:: pair: built-in function; classmethod
351351
352352
The method will be passed the type object as the first parameter rather
353353
than an instance of the type. This is used to create *class methods*,
@@ -357,7 +357,7 @@ method.
357357
358358
.. data:: METH_STATIC
359359
360-
.. index:: builtin: staticmethod
360+
.. index:: pair: built-in function; staticmethod
361361
362362
The method will be passed ``NULL`` as the first parameter rather than an
363363
instance of the type. This is used to create *static methods*, similar to

Doc/c-api/typeobj.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ and :c:type:`PyType_Type` effectively act as defaults.)
805805

806806
.. c:member:: reprfunc PyTypeObject.tp_repr
807807
808-
.. index:: builtin: repr
808+
.. index:: pair: built-in function; repr
809809

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

871871
.. c:member:: hashfunc PyTypeObject.tp_hash
872872
873-
.. index:: builtin: hash
873+
.. index:: pair: built-in function; hash
874874

875875
An optional pointer to a function that implements the built-in function
876876
:func:`hash`.

Doc/extending/newtypes.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ done. This can be done using the :c:func:`PyErr_Fetch` and
149149

150150
.. index::
151151
single: string; object representation
152-
builtin: repr
152+
pair: built-in function; repr
153153

154154
Object Presentation
155155
-------------------

Doc/library/dis.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1367,7 +1367,7 @@ iterations of the loop.
13671367

13681368
.. opcode:: BUILD_SLICE (argc)
13691369

1370-
.. index:: builtin: slice
1370+
.. index:: pair: built-in function; slice
13711371

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

Doc/library/functions.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ are always available. They are listed here in alphabetical order.
562562
Raises an :ref:`auditing event <auditing>` ``exec`` with the code object
563563
as the argument. Code compilation events may also be raised.
564564

565-
.. index:: builtin: exec
565+
.. index:: pair: built-in function; exec
566566

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

Doc/library/pprint.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ The :mod:`pprint` module defines one class:
159159

160160
.. function:: isreadable(object)
161161

162-
.. index:: builtin: eval
162+
.. index:: pair: built-in function; eval
163163

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

219219
.. method:: PrettyPrinter.isreadable(object)
220220

221-
.. index:: builtin: eval
221+
.. index:: pair: built-in function; eval
222222

223223
Determine if the formatted representation of the object is "readable," or can be
224224
used to reconstruct the value using :func:`eval`. Note that this returns

Doc/library/stdtypes.rst

+12-12
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,9 @@ and imaginary parts.
244244

245245
.. index::
246246
single: arithmetic
247-
builtin: int
248-
builtin: float
249-
builtin: complex
247+
pair: built-in function; int
248+
pair: built-in function; float
249+
pair: built-in function; complex
250250
single: operator; + (plus)
251251
single: + (plus); unary operator
252252
single: + (plus); binary operator
@@ -945,9 +945,9 @@ operations have the same priority as the corresponding numeric operations. [3]_
945945

946946
.. index::
947947
triple: operations on; sequence; types
948-
builtin: len
949-
builtin: min
950-
builtin: max
948+
pair: built-in function; len
949+
pair: built-in function; min
950+
pair: built-in function; max
951951
pair: concatenation; operation
952952
pair: repetition; operation
953953
pair: subscript; operation
@@ -1113,7 +1113,7 @@ Immutable Sequence Types
11131113
.. index::
11141114
triple: immutable; sequence; types
11151115
pair: object; tuple
1116-
builtin: hash
1116+
pair: built-in function; hash
11171117

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

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

53505350
.. index::
5351-
builtin: compile
5351+
pair: built-in function; compile
53525352
single: __code__ (function object attribute)
53535353

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

53645364
.. index::
5365-
builtin: exec
5366-
builtin: eval
5365+
pair: built-in function; exec
5366+
pair: built-in function; eval
53675367

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

53795379
.. index::
5380-
builtin: type
5380+
pair: built-in function; type
53815381
pair: module; types
53825382

53835383
Type objects represent the various object types. An object's type is accessed

Doc/library/types.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ Standard names are defined for the following types:
186186

187187
.. class:: CodeType(**kwargs)
188188

189-
.. index:: builtin: compile
189+
.. index:: pair: built-in function; compile
190190

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

Doc/reference/compound_stmts.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ those made in the suite of the for-loop::
188188

189189

190190
.. index::
191-
builtin: range
191+
pair: built-in function; range
192192

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

0 commit comments

Comments
 (0)