Skip to content

Commit 6a970ae

Browse files
[3.11] GH-97950: Use new-style index directive ('statement') (GH-104162) (#104163)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
1 parent 99e6314 commit 6a970ae

File tree

9 files changed

+53
-53
lines changed

9 files changed

+53
-53
lines changed

Doc/library/exceptions.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ Built-in Exceptions
44
===================
55

66
.. index::
7-
statement: try
8-
statement: except
7+
pair: statement; try
8+
pair: statement; except
99

1010
In Python, all exceptions must be instances of a class that derives from
1111
:class:`BaseException`. In a :keyword:`try` statement with an :keyword:`except`
@@ -14,7 +14,7 @@ classes derived from that class (but not exception classes from which *it* is
1414
derived). Two exception classes that are not related via subclassing are never
1515
equivalent, even if they have the same name.
1616

17-
.. index:: statement: raise
17+
.. index:: pair: statement; raise
1818

1919
The built-in exceptions listed below can be generated by the interpreter or
2020
built-in functions. Except where mentioned, they have an "associated value"
@@ -175,7 +175,7 @@ The following exceptions are the exceptions that are usually raised.
175175

176176
.. exception:: AssertionError
177177

178-
.. index:: statement: assert
178+
.. index:: pair: statement; assert
179179

180180
Raised when an :keyword:`assert` statement fails.
181181

Doc/library/functions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1978,7 +1978,7 @@ are always available. They are listed here in alphabetical order.
19781978
.. function:: __import__(name, globals=None, locals=None, fromlist=(), level=0)
19791979

19801980
.. index::
1981-
statement: import
1981+
pair: statement; import
19821982
pair: module; builtins
19831983

19841984
.. note::

Doc/library/site.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ searched for site-packages; otherwise they will.
5151

5252
.. index::
5353
single: # (hash); comment
54-
statement: import
54+
pair: statement; import
5555

5656
A path configuration file is a file whose name has the form :file:`{name}.pth`
5757
and exists in one of the four directories mentioned above; its contents are

Doc/library/stdtypes.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ Truth Value Testing
3232
===================
3333

3434
.. index::
35-
statement: if
36-
statement: while
35+
pair: statement; if
36+
pair: statement; while
3737
pair: truth; value
3838
pair: Boolean; operations
3939
single: false
@@ -1113,7 +1113,7 @@ accepts integers that meet the value restriction ``0 <= x <= 255``).
11131113
triple: operations on; list; type
11141114
pair: subscript; assignment
11151115
pair: slice; assignment
1116-
statement: del
1116+
pair: statement; del
11171117
single: append() (sequence method)
11181118
single: clear() (sequence method)
11191119
single: copy() (sequence method)
@@ -4371,7 +4371,7 @@ Mapping Types --- :class:`dict`
43714371
pair: object; dictionary
43724372
triple: operations on; mapping; types
43734373
triple: operations on; dictionary; type
4374-
statement: del
4374+
pair: statement; del
43754375
builtin: len
43764376

43774377
A :term:`mapping` object maps :term:`hashable` values to arbitrary objects.

Doc/reference/compound_stmts.rst

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ The :keyword:`!if` statement
8484
============================
8585

8686
.. index::
87-
! statement: if
87+
! pair: statement; if
8888
pair: keyword; elif
8989
pair: keyword; else
9090
single: : (colon); compound statement
@@ -109,7 +109,7 @@ The :keyword:`!while` statement
109109
===============================
110110

111111
.. index::
112-
! statement: while
112+
! pair: statement; while
113113
pair: keyword; else
114114
pair: loop; statement
115115
single: : (colon); compound statement
@@ -127,8 +127,8 @@ suite of the :keyword:`!else` clause, if present, is executed and the loop
127127
terminates.
128128

129129
.. index::
130-
statement: break
131-
statement: continue
130+
pair: statement; break
131+
pair: statement; continue
132132

133133
A :keyword:`break` statement executed in the first suite terminates the loop
134134
without executing the :keyword:`!else` clause's suite. A :keyword:`continue`
@@ -142,7 +142,7 @@ The :keyword:`!for` statement
142142
=============================
143143

144144
.. index::
145-
! statement: for
145+
! pair: statement; for
146146
pair: keyword; in
147147
pair: keyword; else
148148
pair: target; list
@@ -167,8 +167,8 @@ the suite in the :keyword:`!else` clause,
167167
if present, is executed, and the loop terminates.
168168

169169
.. index::
170-
statement: break
171-
statement: continue
170+
pair: statement; break
171+
pair: statement; continue
172172

173173
A :keyword:`break` statement executed in the first suite terminates the loop
174174
without executing the :keyword:`!else` clause's suite. A :keyword:`continue`
@@ -205,7 +205,7 @@ The :keyword:`!try` statement
205205
=============================
206206

207207
.. index::
208-
! statement: try
208+
! pair: statement; try
209209
pair: keyword; except
210210
pair: keyword; finally
211211
pair: keyword; else
@@ -390,9 +390,9 @@ cannot appear in an :keyword:`!except*` clause.
390390

391391
.. index::
392392
pair: keyword; else
393-
statement: return
394-
statement: break
395-
statement: continue
393+
pair: statement; return
394+
pair: statement; break
395+
pair: statement; continue
396396

397397
.. _except_else:
398398

@@ -436,9 +436,9 @@ The exception information is not available to the program during execution of
436436
the :keyword:`!finally` clause.
437437

438438
.. index::
439-
statement: return
440-
statement: break
441-
statement: continue
439+
pair: statement; return
440+
pair: statement; break
441+
pair: statement; continue
442442

443443
When a :keyword:`return`, :keyword:`break` or :keyword:`continue` statement is
444444
executed in the :keyword:`try` suite of a :keyword:`!try`...\ :keyword:`!finally`
@@ -470,7 +470,7 @@ The :keyword:`!with` statement
470470
==============================
471471

472472
.. index::
473-
! statement: with
473+
! pair: statement; with
474474
pair: keyword; as
475475
single: as; with statement
476476
single: , (comma); with statement
@@ -587,7 +587,7 @@ The :keyword:`!match` statement
587587
===============================
588588

589589
.. index::
590-
! statement: match
590+
! pair: statement; match
591591
! pair: keyword; case
592592
! single: pattern matching
593593
pair: keyword; if
@@ -1192,7 +1192,7 @@ Function definitions
11921192
====================
11931193

11941194
.. index::
1195-
statement: def
1195+
pair: statement; def
11961196
pair: function; definition
11971197
pair: function; name
11981198
pair: name; binding
@@ -1366,7 +1366,7 @@ Class definitions
13661366

13671367
.. index::
13681368
pair: object; class
1369-
statement: class
1369+
pair: statement; class
13701370
pair: class; definition
13711371
pair: class; name
13721372
pair: name; binding
@@ -1465,7 +1465,7 @@ Coroutines
14651465

14661466
.. versionadded:: 3.5
14671467

1468-
.. index:: statement: async def
1468+
.. index:: pair: statement; async def
14691469
.. _`async def`:
14701470

14711471
Coroutine function definition
@@ -1499,7 +1499,7 @@ An example of a coroutine function::
14991499
``await`` and ``async`` are now keywords; previously they were only
15001500
treated as such inside the body of a coroutine function.
15011501

1502-
.. index:: statement: async for
1502+
.. index:: pair: statement; async for
15031503
.. _`async for`:
15041504

15051505
The :keyword:`!async for` statement
@@ -1544,7 +1544,7 @@ It is a :exc:`SyntaxError` to use an ``async for`` statement outside the
15441544
body of a coroutine function.
15451545

15461546

1547-
.. index:: statement: async with
1547+
.. index:: pair: statement; async with
15481548
.. _`async with`:
15491549

15501550
The :keyword:`!async with` statement

Doc/reference/datamodel.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ Callable types
727727

728728
Modules
729729
.. index::
730-
statement: import
730+
pair: statement; import
731731
pair: object; module
732732

733733
Modules are a basic organizational unit of Python code, and are created by
@@ -1150,7 +1150,7 @@ Internal types
11501150
single: tb_frame (traceback attribute)
11511151
single: tb_lineno (traceback attribute)
11521152
single: tb_lasti (traceback attribute)
1153-
statement: try
1153+
pair: statement; try
11541154

11551155
Special read-only attributes:
11561156
:attr:`tb_frame` points to the execution frame of the current level;
@@ -1309,7 +1309,7 @@ Basic customization
13091309
.. index::
13101310
single: destructor
13111311
single: finalizer
1312-
statement: del
1312+
pair: statement; del
13131313

13141314
Called when the instance is about to be destroyed. This is also called a
13151315
finalizer or (improperly) a destructor. If a base class has a
@@ -2791,7 +2791,7 @@ execution of the block of code. Context managers are normally invoked using the
27912791
used by directly invoking their methods.
27922792

27932793
.. index::
2794-
statement: with
2794+
pair: statement; with
27952795
single: context manager
27962796

27972797
Typical uses of context managers include saving and restoring various kinds of

Doc/reference/simple_stmts.rst

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ The :keyword:`!assert` statement
376376
================================
377377

378378
.. index::
379-
! statement: assert
379+
! pair: statement; assert
380380
pair: debugging; assertions
381381
single: , (comma); expression list
382382

@@ -419,7 +419,7 @@ The :keyword:`!pass` statement
419419
==============================
420420

421421
.. index::
422-
statement: pass
422+
pair: statement; pass
423423
pair: null; operation
424424
pair: null; operation
425425

@@ -441,7 +441,7 @@ The :keyword:`!del` statement
441441
=============================
442442

443443
.. index::
444-
! statement: del
444+
! pair: statement; del
445445
pair: deletion; target
446446
triple: deletion; target; list
447447

@@ -454,7 +454,7 @@ Rather than spelling it out in full details, here are some hints.
454454
Deletion of a target list recursively deletes each target, from left to right.
455455

456456
.. index::
457-
statement: global
457+
pair: statement; global
458458
pair: unbinding; name
459459

460460
Deletion of a name removes the binding of that name from the local or global
@@ -480,7 +480,7 @@ The :keyword:`!return` statement
480480
================================
481481

482482
.. index::
483-
! statement: return
483+
! pair: statement; return
484484
pair: function; definition
485485
pair: class; definition
486486

@@ -517,7 +517,7 @@ The :keyword:`!yield` statement
517517
===============================
518518

519519
.. index::
520-
statement: yield
520+
pair: statement; yield
521521
single: generator; function
522522
single: generator; iterator
523523
single: function; generator
@@ -553,7 +553,7 @@ The :keyword:`!raise` statement
553553
===============================
554554

555555
.. index::
556-
! statement: raise
556+
! pair: statement; raise
557557
single: exception
558558
pair: raising; exception
559559
single: __traceback__ (exception attribute)
@@ -667,9 +667,9 @@ The :keyword:`!break` statement
667667
===============================
668668

669669
.. index::
670-
! statement: break
671-
statement: for
672-
statement: while
670+
! pair: statement; break
671+
pair: statement; for
672+
pair: statement; while
673673
pair: loop; statement
674674

675675
.. productionlist:: python-grammar
@@ -701,9 +701,9 @@ The :keyword:`!continue` statement
701701
==================================
702702

703703
.. index::
704-
! statement: continue
705-
statement: for
706-
statement: while
704+
! pair: statement; continue
705+
pair: statement; for
706+
pair: statement; while
707707
pair: loop; statement
708708
pair: keyword; finally
709709

@@ -726,7 +726,7 @@ The :keyword:`!import` statement
726726
================================
727727

728728
.. index::
729-
! statement: import
729+
! pair: statement; import
730730
single: module; importing
731731
pair: name; binding
732732
pair: keyword; from
@@ -942,7 +942,7 @@ The :keyword:`!global` statement
942942
================================
943943

944944
.. index::
945-
! statement: global
945+
! pair: statement; global
946946
triple: global; name; binding
947947
single: , (comma); identifier list
948948

@@ -988,7 +988,7 @@ call. The same applies to the :func:`eval` and :func:`compile` functions.
988988
The :keyword:`!nonlocal` statement
989989
==================================
990990

991-
.. index:: statement: nonlocal
991+
.. index:: pair: statement; nonlocal
992992
single: , (comma); identifier list
993993

994994
.. productionlist:: python-grammar

Doc/tools/extensions/pyspecific.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ def patch_pairindextypes(app) -> None:
699699
pairindextypes.pop('operator', None)
700700
pairindextypes.pop('object', None)
701701
pairindextypes.pop('exception', None)
702-
# pairindextypes.pop('statement', None)
702+
pairindextypes.pop('statement', None)
703703
# pairindextypes.pop('builtin', None)
704704

705705

Doc/tutorial/controlflow.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ details see :ref:`tut-match`.
4646
==========================
4747

4848
.. index::
49-
statement: for
49+
pair: statement; for
5050

5151
The :keyword:`for` statement in Python differs a bit from what you may be used
5252
to in C or Pascal. Rather than always iterating over an arithmetic progression

0 commit comments

Comments
 (0)