Skip to content

Commit 55d50d1

Browse files
authored
GH-97950: Use new-style index directive ('statement') (#104162)
1 parent 3e7995c commit 55d50d1

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
@@ -1986,7 +1986,7 @@ are always available. They are listed here in alphabetical order.
19861986
.. function:: __import__(name, globals=None, locals=None, fromlist=(), level=0)
19871987

19881988
.. index::
1989-
statement: import
1989+
pair: statement; import
19901990
pair: module; builtins
19911991

19921992
.. 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
@@ -1152,7 +1152,7 @@ accepts integers that meet the value restriction ``0 <= x <= 255``).
11521152
triple: operations on; list; type
11531153
pair: subscript; assignment
11541154
pair: slice; assignment
1155-
statement: del
1155+
pair: statement; del
11561156
single: append() (sequence method)
11571157
single: clear() (sequence method)
11581158
single: copy() (sequence method)
@@ -4418,7 +4418,7 @@ Mapping Types --- :class:`dict`
44184418
pair: object; dictionary
44194419
triple: operations on; mapping; types
44204420
triple: operations on; dictionary; type
4421-
statement: del
4421+
pair: statement; del
44224422
builtin: len
44234423

44244424
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
@@ -388,9 +388,9 @@ cannot appear in an :keyword:`!except*` clause.
388388

389389
.. index::
390390
pair: keyword; else
391-
statement: return
392-
statement: break
393-
statement: continue
391+
pair: statement; return
392+
pair: statement; break
393+
pair: statement; continue
394394

395395
.. _except_else:
396396

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

436436
.. index::
437-
statement: return
438-
statement: break
439-
statement: continue
437+
pair: statement; return
438+
pair: statement; break
439+
pair: statement; continue
440440

441441
When a :keyword:`return`, :keyword:`break` or :keyword:`continue` statement is
442442
executed in the :keyword:`try` suite of a :keyword:`!try`...\ :keyword:`!finally`
@@ -468,7 +468,7 @@ The :keyword:`!with` statement
468468
==============================
469469

470470
.. index::
471-
! statement: with
471+
! pair: statement; with
472472
pair: keyword; as
473473
single: as; with statement
474474
single: , (comma); with statement
@@ -585,7 +585,7 @@ The :keyword:`!match` statement
585585
===============================
586586

587587
.. index::
588-
! statement: match
588+
! pair: statement; match
589589
! pair: keyword; case
590590
! single: pattern matching
591591
pair: keyword; if
@@ -1190,7 +1190,7 @@ Function definitions
11901190
====================
11911191

11921192
.. index::
1193-
statement: def
1193+
pair: statement; def
11941194
pair: function; definition
11951195
pair: function; name
11961196
pair: name; binding
@@ -1364,7 +1364,7 @@ Class definitions
13641364

13651365
.. index::
13661366
pair: object; class
1367-
statement: class
1367+
pair: statement; class
13681368
pair: class; definition
13691369
pair: class; name
13701370
pair: name; binding
@@ -1463,7 +1463,7 @@ Coroutines
14631463

14641464
.. versionadded:: 3.5
14651465

1466-
.. index:: statement: async def
1466+
.. index:: pair: statement; async def
14671467
.. _`async def`:
14681468

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

1500-
.. index:: statement: async for
1500+
.. index:: pair: statement; async for
15011501
.. _`async for`:
15021502

15031503
The :keyword:`!async for` statement
@@ -1542,7 +1542,7 @@ It is a :exc:`SyntaxError` to use an ``async for`` statement outside the
15421542
body of a coroutine function.
15431543

15441544

1545-
.. index:: statement: async with
1545+
.. index:: pair: statement; async with
15461546
.. _`async with`:
15471547

15481548
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
@@ -1151,7 +1151,7 @@ Internal types
11511151
single: tb_frame (traceback attribute)
11521152
single: tb_lineno (traceback attribute)
11531153
single: tb_lasti (traceback attribute)
1154-
statement: try
1154+
pair: statement; try
11551155

11561156
Special read-only attributes:
11571157
:attr:`tb_frame` points to the execution frame of the current level;
@@ -1310,7 +1310,7 @@ Basic customization
13101310
.. index::
13111311
single: destructor
13121312
single: finalizer
1313-
statement: del
1313+
pair: statement; del
13141314

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

27982798
.. index::
2799-
statement: with
2799+
pair: statement; with
28002800
single: context manager
28012801

28022802
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
@@ -694,7 +694,7 @@ def patch_pairindextypes(app) -> None:
694694
pairindextypes.pop('operator', None)
695695
pairindextypes.pop('object', None)
696696
pairindextypes.pop('exception', None)
697-
# pairindextypes.pop('statement', None)
697+
pairindextypes.pop('statement', None)
698698
# pairindextypes.pop('builtin', None)
699699

700700

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)