Skip to content

Commit 1903c29

Browse files
committed
Merge remote-tracking branch 'upstream/main' into whatsnew314
2 parents 25c8714 + 03017a8 commit 1903c29

Some content is hidden

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

61 files changed

+514
-248
lines changed

.editorconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
root = true
22

3-
[*.{py,c,cpp,h,js,rst,md,yml,yaml}]
3+
[*.{py,c,cpp,h,js,rst,md,yml,yaml,gram}]
44
trim_trailing_whitespace = true
55
insert_final_newline = true
66
indent_style = space
77

8-
[*.{py,c,cpp,h}]
8+
[*.{py,c,cpp,h,gram}]
99
indent_size = 4
1010

1111
[*.rst]

.github/workflows/reusable-docs.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
run: |
6767
set -Eeuo pipefail
6868
# Build docs with the nit-picky option; write warnings to file
69-
make -C Doc/ PYTHON=../python SPHINXOPTS="--quiet --nitpicky --fail-on-warning --warning-file sphinx-warnings.txt" html
69+
make -C Doc/ PYTHON=../python SPHINXOPTS="--quiet --nitpicky --warning-file sphinx-warnings.txt" html
7070
- name: 'Check warnings'
7171
if: github.event_name == 'pull_request'
7272
run: |
@@ -75,6 +75,18 @@ jobs:
7575
--fail-if-regression \
7676
--fail-if-improved \
7777
--fail-if-new-news-nit
78+
- name: 'Build EPUB documentation'
79+
continue-on-error: true
80+
run: |
81+
set -Eeuo pipefail
82+
make -C Doc/ PYTHON=../python SPHINXOPTS="--quiet" epub
83+
pip install epubcheck
84+
epubcheck Doc/build/epub/Python.epub &> Doc/epubcheck.txt
85+
- name: 'Check for fatal errors in EPUB'
86+
if: github.event_name == 'pull_request'
87+
continue-on-error: true # until gh-136155 is fixed
88+
run: |
89+
python Doc/tools/check-epub.py
7890
7991
# Run "doctest" on HEAD as new syntax doesn't exist in the latest stable release
8092
doctest:

Doc/c-api/init_config.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -975,9 +975,7 @@ PyPreConfig
975975
Set to ``0`` or ``1`` by the :option:`-X utf8 <-X>` command line option
976976
and the :envvar:`PYTHONUTF8` environment variable.
977977
978-
Also set to ``1`` if the ``LC_CTYPE`` locale is ``C`` or ``POSIX``.
979-
980-
Default: ``-1`` in Python config and ``0`` in isolated config.
978+
Default: ``1``.
981979
982980
983981
.. _c-preinit:

Doc/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@
448448

449449
epub_author = 'Python Documentation Authors'
450450
epub_publisher = 'Python Software Foundation'
451+
epub_exclude_files = ('index.xhtml', 'download.xhtml')
451452

452453
# index pages are not valid xhtml
453454
# https://github.com/sphinx-doc/sphinx/issues/12359

Doc/library/doctest.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,13 @@ Which Docstrings Are Examined?
311311
The module docstring, and all function, class and method docstrings are
312312
searched. Objects imported into the module are not searched.
313313

314+
.. currentmodule:: None
315+
314316
.. attribute:: module.__test__
315317
:no-typesetting:
316318

319+
.. currentmodule:: doctest
320+
317321
In addition, there are cases when you want tests to be part of a module but not part
318322
of the help text, which requires that the tests not be included in the docstring.
319323
Doctest looks for a module-level variable called ``__test__`` and uses it to locate other

Doc/library/hmac.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
--------------
1313

1414
This module implements the HMAC algorithm as described by :rfc:`2104`.
15+
The interface allows to use any hash function with a *fixed* digest size.
16+
In particular, extendable output functions such as SHAKE-128 or SHAKE-256
17+
cannot be used with HMAC.
1518

1619

1720
.. function:: new(key, msg=None, digestmod)

Doc/library/importlib.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,10 @@ Functions
206206
:exc:`ModuleNotFoundError` is raised when the module being reloaded lacks
207207
a :class:`~importlib.machinery.ModuleSpec`.
208208

209+
.. warning::
210+
This function is not thread-safe. Calling it from multiple threads can result
211+
in unexpected behavior. It's recommended to use the :class:`threading.Lock`
212+
or other synchronization primitives for thread-safe module reloading.
209213

210214
:mod:`importlib.abc` -- Abstract base classes related to import
211215
---------------------------------------------------------------

Doc/library/logging.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1317,7 +1317,7 @@ functions.
13171317
In Python versions earlier than 3.4, this function could also be passed a
13181318
text level, and would return the corresponding numeric value of the level.
13191319
This undocumented behaviour was considered a mistake, and was removed in
1320-
Python 3.4, but reinstated in 3.4.2 due to retain backward compatibility.
1320+
Python 3.4, but reinstated in 3.4.2 in order to retain backward compatibility.
13211321

13221322
.. function:: getHandlerByName(name)
13231323

Doc/library/os.path.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -508,9 +508,6 @@ the :mod:`glob` module.)
508508
.. versionchanged:: 3.4
509509
Added Windows support.
510510

511-
.. versionchanged:: 3.6
512-
Accepts a :term:`path-like object`.
513-
514511

515512
.. function:: split(path)
516513

Doc/library/os.rst

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ Python UTF-8 Mode
108108
.. versionadded:: 3.7
109109
See :pep:`540` for more details.
110110

111+
.. versionchanged:: next
112+
113+
Python UTF-8 mode is now enabled by default (:pep:`686`).
114+
It may be disabled with by setting :envvar:`PYTHONUTF8=0 <PYTHONUTF8>` as
115+
an environment variable or by using the :option:`-X utf8=0 <-X>` command line option.
116+
111117
The Python UTF-8 Mode ignores the :term:`locale encoding` and forces the usage
112118
of the UTF-8 encoding:
113119

@@ -139,31 +145,22 @@ level APIs also exhibit different default behaviours:
139145
default so that attempting to open a binary file in text mode is likely
140146
to raise an exception rather than producing nonsense data.
141147

142-
The :ref:`Python UTF-8 Mode <utf8-mode>` is enabled if the LC_CTYPE locale is
143-
``C`` or ``POSIX`` at Python startup (see the :c:func:`PyConfig_Read`
144-
function).
145-
146-
It can be enabled or disabled using the :option:`-X utf8 <-X>` command line
147-
option and the :envvar:`PYTHONUTF8` environment variable.
148-
149-
If the :envvar:`PYTHONUTF8` environment variable is not set at all, then the
150-
interpreter defaults to using the current locale settings, *unless* the current
151-
locale is identified as a legacy ASCII-based locale (as described for
152-
:envvar:`PYTHONCOERCECLOCALE`), and locale coercion is either disabled or
153-
fails. In such legacy locales, the interpreter will default to enabling UTF-8
154-
mode unless explicitly instructed not to do so.
155-
156-
The Python UTF-8 Mode can only be enabled at the Python startup. Its value
148+
The :ref:`Python UTF-8 Mode <utf8-mode>` is enabled by default.
149+
It can be disabled using the :option:`-X utf8=0 <-X>` command line
150+
option or the :envvar:`PYTHONUTF8=0 <PYTHONUTF8>` environment variable.
151+
The Python UTF-8 Mode can only be disabled at Python startup. Its value
157152
can be read from :data:`sys.flags.utf8_mode <sys.flags>`.
158153

154+
If the UTF-8 mode is disabled, the interpreter defaults to using
155+
the current locale settings, *unless* the current locale is identified
156+
as a legacy ASCII-based locale (as described for :envvar:`PYTHONCOERCECLOCALE`),
157+
and locale coercion is either disabled or fails.
158+
In such legacy locales, the interpreter will default to enabling UTF-8 mode
159+
unless explicitly instructed not to do so.
160+
159161
See also the :ref:`UTF-8 mode on Windows <win-utf8-mode>`
160162
and the :term:`filesystem encoding and error handler`.
161163

162-
.. seealso::
163-
164-
:pep:`686`
165-
Python 3.15 will make :ref:`utf8-mode` default.
166-
167164

168165
.. _os-procinfo:
169166

0 commit comments

Comments
 (0)