Skip to content

Commit 30cd34d

Browse files
committed
Merge branch 'hy/fix_issue_134163' of https://github.com/yihong0618/cpython into hy/fix_issue_134163
2 parents edcfff7 + 06b779a commit 30cd34d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+564
-222
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ repos:
1010
name: Run Ruff (lint) on Lib/test/
1111
args: [--exit-non-zero-on-fix]
1212
files: ^Lib/test/
13+
- id: ruff
14+
name: Run Ruff (lint) on Tools/i18n/
15+
args: [--exit-non-zero-on-fix, --config=Tools/i18n/.ruff.toml]
16+
files: ^Tools/i18n/
1317
- id: ruff
1418
name: Run Ruff (lint) on Argument Clinic
1519
args: [--exit-non-zero-on-fix, --config=Tools/clinic/.ruff.toml]

Doc/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@
237237
('py:attr', '__annotations__'),
238238
('py:meth', '__missing__'),
239239
('py:attr', '__wrapped__'),
240-
('py:meth', 'index'), # list.index, tuple.index, etc.
241240
]
242241

243242
# gh-106948: Copy standard C types declared in the "c:type" domain and C

Doc/faq/design.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,9 +589,9 @@ exhaustive test suites that exercise every line of code in a module.
589589
An appropriate testing discipline can help build large complex applications in
590590
Python as well as having interface specifications would. In fact, it can be
591591
better because an interface specification cannot test certain properties of a
592-
program. For example, the :meth:`!list.append` method is expected to add new elements
592+
program. For example, the :meth:`list.append` method is expected to add new elements
593593
to the end of some internal list; an interface specification cannot test that
594-
your :meth:`!list.append` implementation will actually do this correctly, but it's
594+
your :meth:`list.append` implementation will actually do this correctly, but it's
595595
trivial to check this property in a test suite.
596596

597597
Writing test suites is very helpful, and you might want to design your code to

Doc/faq/programming.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ There are two factors that produce this result:
454454
(the list), and both ``x`` and ``y`` refer to it.
455455
2) Lists are :term:`mutable`, which means that you can change their content.
456456

457-
After the call to :meth:`!append`, the content of the mutable object has
457+
After the call to :meth:`~sequence.append`, the content of the mutable object has
458458
changed from ``[]`` to ``[10]``. Since both the variables refer to the same
459459
object, using either name accesses the modified value ``[10]``.
460460

@@ -1397,9 +1397,9 @@ To see why this happens, you need to know that (a) if an object implements an
13971397
:meth:`~object.__iadd__` magic method, it gets called when the ``+=`` augmented
13981398
assignment
13991399
is executed, and its return value is what gets used in the assignment statement;
1400-
and (b) for lists, :meth:`!__iadd__` is equivalent to calling :meth:`!extend` on the list
1401-
and returning the list. That's why we say that for lists, ``+=`` is a
1402-
"shorthand" for :meth:`!list.extend`::
1400+
and (b) for lists, :meth:`!__iadd__` is equivalent to calling
1401+
:meth:`~sequence.extend` on the list and returning the list.
1402+
That's why we say that for lists, ``+=`` is a "shorthand" for :meth:`list.extend`::
14031403

14041404
>>> a_list = []
14051405
>>> a_list += [1]

Doc/glossary.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ Glossary
2121
right delimiters (parentheses, square brackets, curly braces or triple
2222
quotes), or after specifying a decorator.
2323

24-
* The :const:`Ellipsis` built-in constant.
24+
.. index:: single: ...; ellipsis literal
25+
26+
* The three dots form of the :ref:`Ellipsis <bltin-ellipsis-object>` object.
2527

2628
abstract base class
2729
Abstract base classes complement :term:`duck-typing` by
@@ -1203,8 +1205,9 @@ Glossary
12031205
The :class:`collections.abc.Sequence` abstract base class
12041206
defines a much richer interface that goes beyond just
12051207
:meth:`~object.__getitem__` and :meth:`~object.__len__`, adding
1206-
:meth:`!count`, :meth:`!index`, :meth:`~object.__contains__`, and
1207-
:meth:`~object.__reversed__`. Types that implement this expanded
1208+
:meth:`~sequence.count`, :meth:`~sequence.index`,
1209+
:meth:`~object.__contains__`, and :meth:`~object.__reversed__`.
1210+
Types that implement this expanded
12081211
interface can be registered explicitly using
12091212
:func:`~abc.ABCMeta.register`. For more documentation on sequence
12101213
methods generally, see

Doc/library/bisect.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ The following functions are provided:
8383
Insert *x* in *a* in sorted order.
8484

8585
This function first runs :py:func:`~bisect.bisect_left` to locate an insertion point.
86-
Next, it runs the :meth:`!insert` method on *a* to insert *x* at the
86+
Next, it runs the :meth:`~sequence.insert` method on *a* to insert *x* at the
8787
appropriate position to maintain sort order.
8888

8989
To support inserting records in a table, the *key* function (if any) is
@@ -103,7 +103,7 @@ The following functions are provided:
103103
entries of *x*.
104104

105105
This function first runs :py:func:`~bisect.bisect_right` to locate an insertion point.
106-
Next, it runs the :meth:`!insert` method on *a* to insert *x* at the
106+
Next, it runs the :meth:`~sequence.insert` method on *a* to insert *x* at the
107107
appropriate position to maintain sort order.
108108

109109
To support inserting records in a table, the *key* function (if any) is

Doc/library/collections.abc.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,9 @@ Collections Abstract Base Classes -- Detailed Descriptions
268268
ABCs for read-only and mutable :term:`sequences <sequence>`.
269269

270270
Implementation note: Some of the mixin methods, such as
271-
:meth:`~container.__iter__`, :meth:`~object.__reversed__` and :meth:`index`, make
272-
repeated calls to the underlying :meth:`~object.__getitem__` method.
271+
:meth:`~container.__iter__`, :meth:`~object.__reversed__`,
272+
and :meth:`~sequence.index` make repeated calls to the underlying
273+
:meth:`~object.__getitem__` method.
273274
Consequently, if :meth:`~object.__getitem__` is implemented with constant
274275
access speed, the mixin methods will have linear performance;
275276
however, if the underlying method is linear (as it would be with a
@@ -285,8 +286,8 @@ Collections Abstract Base Classes -- Detailed Descriptions
285286
Supporting the *start* and *stop* arguments is optional, but recommended.
286287

287288
.. versionchanged:: 3.5
288-
The :meth:`!index` method added support for *stop* and *start*
289-
arguments.
289+
The :meth:`~sequence.index` method gained support for
290+
the *stop* and *start* arguments.
290291

291292
.. deprecated-removed:: 3.12 3.14
292293
The :class:`ByteString` ABC has been deprecated.

Doc/library/collections.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -783,10 +783,10 @@ sequence of key-value pairs into a dictionary of lists:
783783

784784
When each key is encountered for the first time, it is not already in the
785785
mapping; so an entry is automatically created using the :attr:`~defaultdict.default_factory`
786-
function which returns an empty :class:`list`. The :meth:`!list.append`
786+
function which returns an empty :class:`list`. The :meth:`list.append`
787787
operation then attaches the value to the new list. When keys are encountered
788788
again, the look-up proceeds normally (returning the list for that key) and the
789-
:meth:`!list.append` operation adds another value to the list. This technique is
789+
:meth:`list.append` operation adds another value to the list. This technique is
790790
simpler and faster than an equivalent technique using :meth:`dict.setdefault`:
791791

792792
>>> d = {}

Doc/library/constants.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ A small number of constants live in the built-in namespace. They are:
6262
.. index:: single: ...; ellipsis literal
6363
.. data:: Ellipsis
6464

65-
The same as the ellipsis literal "``...``". Special value used mostly in conjunction
66-
with extended slicing syntax for user-defined container data types.
65+
The same as the ellipsis literal "``...``", an object frequently used to
66+
indicate that something is omitted. Assignment to ``Ellipsis`` is possible, but
67+
assignment to ``...`` raises a :exc:`SyntaxError`.
6768
``Ellipsis`` is the sole instance of the :data:`types.EllipsisType` type.
6869

6970

Doc/library/gc.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ The :mod:`gc` module provides the following functions:
113113
been examined more than *threshold1* times since generation ``1`` has been
114114
examined, then generation ``1`` is examined as well.
115115
With the third generation, things are a bit more complicated,
116-
see `Collecting the oldest generation <https://devguide.python.org/garbage_collector/#collecting-the-oldest-generation>`_ for more information.
116+
see `Collecting the oldest generation <https://github.com/python/cpython/blob/ff0ef0a54bef26fc507fbf9b7a6009eb7d3f17f5/InternalDocs/garbage_collector.md#collecting-the-oldest-generation>`_ for more information.
117117

118118

119119
.. function:: get_count()

0 commit comments

Comments
 (0)