Skip to content

Commit 5001c54

Browse files
committed
Merge remote-tracking branch 'upstream/main' into gh-140138
2 parents d08a093 + 790cdae commit 5001c54

Some content is hidden

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

43 files changed

+478
-187
lines changed

.github/workflows/mypy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ on:
1616
- "Tools/build/check_extension_modules.py"
1717
- "Tools/build/check_warnings.py"
1818
- "Tools/build/compute-changes.py"
19+
- "Tools/build/consts_getter.py"
1920
- "Tools/build/deepfreeze.py"
2021
- "Tools/build/generate-build-details.py"
2122
- "Tools/build/generate_sbom.py"

Doc/bugs.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ If you find a bug in this documentation or would like to propose an improvement,
1919
please submit a bug report on the :ref:`issue tracker <using-the-tracker>`. If you
2020
have a suggestion on how to fix it, include that as well.
2121

22+
.. only:: translation
23+
24+
If the bug or suggested improvement concerns the translation of this
25+
documentation, submit the report to the
26+
`translation’s repository <TRANSLATION_REPO_>`_ instead.
27+
2228
You can also open a discussion item on our
2329
`Documentation Discourse forum <https://discuss.python.org/c/documentation/26>`_.
2430

Doc/c-api/long.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
4343
.. impl-detail::
4444
4545
CPython keeps an array of integer objects for all integers
46-
between ``-5`` and ``256``. When you create an int in that range
46+
between ``-5`` and ``1024``. When you create an int in that range
4747
you actually just get back a reference to the existing object.
4848
4949

Doc/c-api/stable.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ The full API is described below for advanced use cases.
294294
Default flags, based on current values of macros such as
295295
:c:macro:`Py_LIMITED_API` and :c:macro:`Py_GIL_DISABLED`.
296296

297-
Alternately, the field can be set to to the following flags, combined
297+
Alternately, the field can be set to the following flags, combined
298298
by bitwise OR.
299299
Unused bits must be set to zero.
300300

Doc/conf.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,25 @@
444444
# https://github.com/sphinx-doc/sphinx/issues/12359
445445
epub_use_index = False
446446

447+
# translation tag
448+
# ---------------
449+
450+
language_code = None
451+
for arg in sys.argv:
452+
if arg.startswith('language='):
453+
language_code = arg.split('=', 1)[1]
454+
455+
if language_code:
456+
tags.add('translation') # noqa: F821
457+
458+
rst_epilog += f"""\
459+
.. _TRANSLATION_REPO: https://github.com/python/python-docs-{language_code.replace("_", "-").lower()}
460+
""" # noqa: F821
461+
else:
462+
rst_epilog += """\
463+
.. _TRANSLATION_REPO: https://github.com/python
464+
"""
465+
447466
# Options for the coverage checker
448467
# --------------------------------
449468

Doc/library/codecs.rst

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -989,17 +989,22 @@ defined in Unicode. A simple and straightforward way that can store each Unicode
989989
code point, is to store each code point as four consecutive bytes. There are two
990990
possibilities: store the bytes in big endian or in little endian order. These
991991
two encodings are called ``UTF-32-BE`` and ``UTF-32-LE`` respectively. Their
992-
disadvantage is that if e.g. you use ``UTF-32-BE`` on a little endian machine you
993-
will always have to swap bytes on encoding and decoding. ``UTF-32`` avoids this
994-
problem: bytes will always be in natural endianness. When these bytes are read
995-
by a CPU with a different endianness, then bytes have to be swapped though. To
996-
be able to detect the endianness of a ``UTF-16`` or ``UTF-32`` byte sequence,
997-
there's the so called BOM ("Byte Order Mark"). This is the Unicode character
998-
``U+FEFF``. This character can be prepended to every ``UTF-16`` or ``UTF-32``
999-
byte sequence. The byte swapped version of this character (``0xFFFE``) is an
1000-
illegal character that may not appear in a Unicode text. So when the
1001-
first character in a ``UTF-16`` or ``UTF-32`` byte sequence
1002-
appears to be a ``U+FFFE`` the bytes have to be swapped on decoding.
992+
disadvantage is that if, for example, you use ``UTF-32-BE`` on a little endian
993+
machine you will always have to swap bytes on encoding and decoding.
994+
Python's ``UTF-16`` and ``UTF-32`` codecs avoid this problem by using the
995+
platform's native byte order when no BOM is present.
996+
Python follows prevailing platform
997+
practice, so native-endian data round-trips without redundant byte swapping,
998+
even though the Unicode Standard defaults to big-endian when the byte order is
999+
unspecified. When these bytes are read by a CPU with a different endianness,
1000+
the bytes have to be swapped. To be able to detect the endianness of a
1001+
``UTF-16`` or ``UTF-32`` byte sequence, a BOM ("Byte Order Mark") is used.
1002+
This is the Unicode character ``U+FEFF``. This character can be prepended to every
1003+
``UTF-16`` or ``UTF-32`` byte sequence. The byte swapped version of this character
1004+
(``0xFFFE``) is an illegal character that may not appear in a Unicode text.
1005+
When the first character of a ``UTF-16`` or ``UTF-32`` byte sequence is
1006+
``U+FFFE``, the bytes have to be swapped on decoding.
1007+
10031008
Unfortunately the character ``U+FEFF`` had a second purpose as
10041009
a ``ZERO WIDTH NO-BREAK SPACE``: a character that has no width and doesn't allow
10051010
a word to be split. It can e.g. be used to give hints to a ligature algorithm.

Doc/library/importlib.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1257,7 +1257,7 @@ find and load modules.
12571257
To accommodate this requirement, when running on iOS, extension module
12581258
binaries are *not* packaged as ``.so`` files on ``sys.path``, but as
12591259
individual standalone frameworks. To discover those frameworks, this loader
1260-
is be registered against the ``.fwork`` file extension, with a ``.fwork``
1260+
is registered against the ``.fwork`` file extension, with a ``.fwork``
12611261
file acting as a placeholder in the original location of the binary on
12621262
``sys.path``. The ``.fwork`` file contains the path of the actual binary in
12631263
the ``Frameworks`` folder, relative to the app bundle. To allow for

Doc/library/stdtypes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5944,7 +5944,7 @@ It is written as ``None``.
59445944
The Ellipsis Object
59455945
-------------------
59465946

5947-
This object is commonly used used to indicate that something is omitted.
5947+
This object is commonly used to indicate that something is omitted.
59485948
It supports no special operations. There is exactly one ellipsis object, named
59495949
:const:`Ellipsis` (a built-in name). ``type(Ellipsis)()`` produces the
59505950
:const:`Ellipsis` singleton.

Doc/library/tkinter.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -839,8 +839,7 @@ geometry
839839
For example: ``fred["geometry"] = "200x100"``.
840840

841841
justify
842-
Legal values are the strings: ``"left"``, ``"center"``, ``"right"``, and
843-
``"fill"``.
842+
Legal values are the strings: ``"left"``, ``"center"``, and ``"right"``.
844843

845844
region
846845
This is a string with four space-delimited elements, each of which is a legal

Doc/library/warnings.rst

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -480,14 +480,21 @@ Available Functions
480480
.. function:: warn_explicit(message, category, filename, lineno, module=None, registry=None, module_globals=None, source=None)
481481

482482
This is a low-level interface to the functionality of :func:`warn`, passing in
483-
explicitly the message, category, filename and line number, and optionally the
484-
module name and the registry (which should be the ``__warningregistry__``
485-
dictionary of the module). The module name defaults to the filename with
486-
``.py`` stripped; if no registry is passed, the warning is never suppressed.
483+
explicitly the message, category, filename and line number, and optionally
484+
other arguments.
487485
*message* must be a string and *category* a subclass of :exc:`Warning` or
488486
*message* may be a :exc:`Warning` instance, in which case *category* will be
489487
ignored.
490488

489+
*module*, if supplied, should be the module name.
490+
If no module is passed, the filename with ``.py`` stripped is used.
491+
492+
*registry*, if supplied, should be the ``__warningregistry__`` dictionary
493+
of the module.
494+
If no registry is passed, each warning is treated as the first occurrence,
495+
that is, filter actions ``"default"``, ``"module"`` and ``"once"`` are
496+
handled as ``"always"``.
497+
491498
*module_globals*, if supplied, should be the global namespace in use by the code
492499
for which the warning is issued. (This argument is used to support displaying
493500
source for modules found in zipfiles or other non-filesystem import

0 commit comments

Comments
 (0)