Skip to content

Commit 4b11af0

Browse files
[3.11] GH-97950: Use new-style index directive ('builtin') (GH-104164) (#104221)
GH-97950: Use new-style index directive ('builtin') (GH-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 (cherry picked from commit f508800) Co-authored-by: Adam Turner <[email protected]>
1 parent a635d63 commit 4b11af0

23 files changed

+77
-77
lines changed

Doc/c-api/dict.rst

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 6 additions & 6 deletions
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

Lines changed: 6 additions & 6 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ method.
366366
367367
.. data:: METH_CLASS
368368
369-
.. index:: builtin: classmethod
369+
.. index:: pair: built-in function; classmethod
370370
371371
The method will be passed the type object as the first parameter rather
372372
than an instance of the type. This is used to create *class methods*,
@@ -376,7 +376,7 @@ method.
376376
377377
.. data:: METH_STATIC
378378
379-
.. index:: builtin: staticmethod
379+
.. index:: pair: built-in function; staticmethod
380380
381381
The method will be passed ``NULL`` as the first parameter rather than an
382382
instance of the type. This is used to create *static methods*, similar to

Doc/c-api/typeobj.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ and :c:type:`PyType_Type` effectively act as defaults.)
803803

804804
.. c:member:: reprfunc PyTypeObject.tp_repr
805805
806-
.. index:: builtin: repr
806+
.. index:: pair: built-in function; repr
807807

808808
An optional pointer to a function that implements the built-in function
809809
:func:`repr`.
@@ -868,7 +868,7 @@ and :c:type:`PyType_Type` effectively act as defaults.)
868868

869869
.. c:member:: hashfunc PyTypeObject.tp_hash
870870
871-
.. index:: builtin: hash
871+
.. index:: pair: built-in function; hash
872872

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

Doc/extending/newtypes.rst

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1268,7 +1268,7 @@ iterations of the loop.
12681268

12691269
.. opcode:: BUILD_SLICE (argc)
12701270

1271-
.. index:: builtin: slice
1271+
.. index:: pair: built-in function; slice
12721272

12731273
Pushes a slice object on the stack. *argc* must be 2 or 3. If it is 2,
12741274
``slice(TOS1, TOS)`` is pushed; if it is 3, ``slice(TOS2, TOS1, TOS)`` is

Doc/library/functions.rst

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

564-
.. index:: builtin: exec
564+
.. index:: pair: built-in function; exec
565565

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

Doc/library/pprint.rst

Lines changed: 2 additions & 2 deletions
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``
@@ -214,7 +214,7 @@ created.
214214

215215
.. method:: PrettyPrinter.isreadable(object)
216216

217-
.. index:: builtin: eval
217+
.. index:: pair: built-in function; eval
218218

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

Doc/library/stdtypes.rst

Lines changed: 12 additions & 12 deletions
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
@@ -906,9 +906,9 @@ operations have the same priority as the corresponding numeric operations. [3]_
906906

907907
.. index::
908908
triple: operations on; sequence; types
909-
builtin: len
910-
builtin: min
911-
builtin: max
909+
pair: built-in function; len
910+
pair: built-in function; min
911+
pair: built-in function; max
912912
pair: concatenation; operation
913913
pair: repetition; operation
914914
pair: subscript; operation
@@ -1074,7 +1074,7 @@ Immutable Sequence Types
10741074
.. index::
10751075
triple: immutable; sequence; types
10761076
pair: object; tuple
1077-
builtin: hash
1077+
pair: built-in function; hash
10781078

10791079
The only operation that immutable sequence types generally implement that is
10801080
not also implemented by mutable sequence types is support for the :func:`hash`
@@ -4372,7 +4372,7 @@ Mapping Types --- :class:`dict`
43724372
triple: operations on; mapping; types
43734373
triple: operations on; dictionary; type
43744374
pair: statement; del
4375-
builtin: len
4375+
pair: built-in function; len
43764376

43774377
A :term:`mapping` object maps :term:`hashable` values to arbitrary objects.
43784378
Mappings are mutable objects. There is currently only one standard mapping
@@ -5295,7 +5295,7 @@ Code Objects
52955295
------------
52965296

52975297
.. index::
5298-
builtin: compile
5298+
pair: built-in function; compile
52995299
single: __code__ (function object attribute)
53005300

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

53115311
.. index::
5312-
builtin: exec
5313-
builtin: eval
5312+
pair: built-in function; exec
5313+
pair: built-in function; eval
53145314

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

53265326
.. index::
5327-
builtin: type
5327+
pair: built-in function; type
53285328
pair: module; types
53295329

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

Doc/library/types.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ Standard names are defined for the following types:
146146

147147
.. class:: CodeType(**kwargs)
148148

149-
.. index:: builtin: compile
149+
.. index:: pair: built-in function; compile
150150

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

Doc/reference/compound_stmts.rst

Lines changed: 1 addition & 1 deletion
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)