Skip to content

Commit 6fc4226

Browse files
authored
Merge branch 'main' into fix-issue-124452
2 parents 7e40938 + 1306f33 commit 6fc4226

File tree

96 files changed

+1470
-596
lines changed

Some content is hidden

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

96 files changed

+1470
-596
lines changed

Doc/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@
9494

9595
# Create table of contents entries for domain objects (e.g. functions, classes,
9696
# attributes, etc.). Default is True.
97-
toc_object_entries = False
97+
toc_object_entries = True
98+
toc_object_entries_show_parents = 'hide'
9899

99100
# Ignore any .rst files in the includes/ directory;
100101
# they're embedded in pages but not rendered individually.

Doc/deprecations/pending-removal-in-future.rst

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,6 @@ Pending removal in future versions
44
The following APIs will be removed in the future,
55
although there is currently no date scheduled for their removal.
66

7-
* :mod:`argparse`:
8-
9-
* Nesting argument groups and nesting mutually exclusive
10-
groups are deprecated.
11-
* Passing the undocumented keyword argument *prefix_chars* to
12-
:meth:`~argparse.ArgumentParser.add_argument_group` is now
13-
deprecated.
14-
15-
* :mod:`array`'s ``'u'`` format code (:gh:`57281`)
16-
177
* :mod:`builtins`:
188

199
* ``bool(NotImplemented)``.
@@ -43,6 +33,17 @@ although there is currently no date scheduled for their removal.
4333
as a single positional argument.
4434
(Contributed by Serhiy Storchaka in :gh:`109218`.)
4535

36+
* :mod:`argparse`:
37+
38+
* Nesting argument groups and nesting mutually exclusive
39+
groups are deprecated.
40+
* Passing the undocumented keyword argument *prefix_chars* to
41+
:meth:`~argparse.ArgumentParser.add_argument_group` is now
42+
deprecated.
43+
* The :class:`argparse.FileType` type converter is deprecated.
44+
45+
* :mod:`array`'s ``'u'`` format code (:gh:`57281`)
46+
4647
* :mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants are
4748
deprecated and replaced by :data:`calendar.JANUARY` and
4849
:data:`calendar.FEBRUARY`.

Doc/library/argparse.rst

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -865,16 +865,14 @@ See also :ref:`specifying-ambiguous-arguments`. The supported values are:
865865
output files::
866866

867867
>>> parser = argparse.ArgumentParser()
868-
>>> parser.add_argument('infile', nargs='?', type=argparse.FileType('r'),
869-
... default=sys.stdin)
870-
>>> parser.add_argument('outfile', nargs='?', type=argparse.FileType('w'),
871-
... default=sys.stdout)
868+
>>> parser.add_argument('infile', nargs='?')
869+
>>> parser.add_argument('outfile', nargs='?')
872870
>>> parser.parse_args(['input.txt', 'output.txt'])
873-
Namespace(infile=<_io.TextIOWrapper name='input.txt' encoding='UTF-8'>,
874-
outfile=<_io.TextIOWrapper name='output.txt' encoding='UTF-8'>)
871+
Namespace(infile='input.txt', outfile='output.txt')
872+
>>> parser.parse_args(['input.txt'])
873+
Namespace(infile='input.txt', outfile=None)
875874
>>> parser.parse_args([])
876-
Namespace(infile=<_io.TextIOWrapper name='<stdin>' encoding='UTF-8'>,
877-
outfile=<_io.TextIOWrapper name='<stdout>' encoding='UTF-8'>)
875+
Namespace(infile=None, outfile=None)
878876

879877
.. index:: single: * (asterisk); in argparse module
880878

@@ -1033,7 +1031,6 @@ Common built-in types and functions can be used as type converters:
10331031
parser.add_argument('distance', type=float)
10341032
parser.add_argument('street', type=ascii)
10351033
parser.add_argument('code_point', type=ord)
1036-
parser.add_argument('dest_file', type=argparse.FileType('w', encoding='latin-1'))
10371034
parser.add_argument('datapath', type=pathlib.Path)
10381035

10391036
User defined functions can be used as well:
@@ -1827,9 +1824,19 @@ FileType objects
18271824
>>> parser.parse_args(['-'])
18281825
Namespace(infile=<_io.TextIOWrapper name='<stdin>' encoding='UTF-8'>)
18291826

1827+
.. note::
1828+
1829+
If one argument uses *FileType* and then a subsequent argument fails,
1830+
an error is reported but the file is not automatically closed.
1831+
This can also clobber the output files.
1832+
In this case, it would be better to wait until after the parser has
1833+
run and then use the :keyword:`with`-statement to manage the files.
1834+
18301835
.. versionchanged:: 3.4
18311836
Added the *encodings* and *errors* parameters.
18321837

1838+
.. deprecated:: 3.14
1839+
18331840

18341841
Argument groups
18351842
^^^^^^^^^^^^^^^

Doc/library/sys.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,35 @@ always available.
920920
It is not guaranteed to exist in all implementations of Python.
921921

922922

923+
.. function:: getobjects(limit[, type])
924+
925+
This function only exists if CPython was built using the
926+
specialized configure option :option:`--with-trace-refs`.
927+
It is intended only for debugging garbage-collection issues.
928+
929+
Return a list of up to *limit* dynamically allocated Python objects.
930+
If *type* is given, only objects of that exact type (not subtypes)
931+
are included.
932+
933+
Objects from the list are not safe to use.
934+
Specifically, the result will include objects from all interpreters that
935+
share their object allocator state (that is, ones created with
936+
:c:member:`PyInterpreterConfig.use_main_obmalloc` set to 1
937+
or using :c:func:`Py_NewInterpreter`, and the
938+
:ref:`main interpreter <sub-interpreter-support>`).
939+
Mixing objects from different interpreters may lead to crashes
940+
or other unexpected behavior.
941+
942+
.. impl-detail::
943+
944+
This function should be used for specialized purposes only.
945+
It is not guaranteed to exist in all implementations of Python.
946+
947+
.. versionchanged:: next
948+
949+
The result may include objects from other interpreters.
950+
951+
923952
.. function:: getprofile()
924953

925954
.. index::

Doc/library/turtle.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2778,9 +2778,6 @@ Changes since Python 3.0
27782778
:func:`Screen.numinput <numinput>`. These pop up input dialogs and return
27792779
strings and numbers respectively.
27802780

2781-
- Two example scripts :file:`tdemo_nim.py` and :file:`tdemo_round_dance.py`
2782-
have been added to the :file:`Lib/turtledemo` directory.
2783-
27842781

27852782
.. doctest::
27862783
:skipif: _tkinter is None

Doc/library/unittest.rst

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -340,28 +340,21 @@ Test modules and packages can customize test loading and discovery by through
340340
the `load_tests protocol`_.
341341

342342
.. versionchanged:: 3.4
343-
Test discovery supports :term:`namespace packages <namespace package>`
344-
for the start directory. Note that you need to specify the top level
345-
directory too (e.g.
346-
``python -m unittest discover -s root/namespace -t root``).
343+
Test discovery supports :term:`namespace packages <namespace package>`.
347344

348345
.. versionchanged:: 3.11
349-
:mod:`unittest` dropped the :term:`namespace packages <namespace package>`
350-
support in Python 3.11. It has been broken since Python 3.7. Start directory and
351-
subdirectories containing tests must be regular package that have
352-
``__init__.py`` file.
346+
Test discovery dropped the :term:`namespace packages <namespace package>`
347+
support. It has been broken since Python 3.7.
348+
Start directory and its subdirectories containing tests must be regular
349+
package that have ``__init__.py`` file.
353350

354-
Directories containing start directory still can be a namespace package.
355-
In this case, you need to specify start directory as dotted package name,
356-
and target directory explicitly. For example::
351+
If the start directory is the dotted name of the package, the ancestor packages
352+
can be namespace packages.
357353

358-
# proj/ <-- current directory
359-
# namespace/
360-
# mypkg/
361-
# __init__.py
362-
# test_mypkg.py
363-
364-
python -m unittest discover -s namespace.mypkg -t .
354+
.. versionchanged:: 3.14
355+
Test discovery supports :term:`namespace package` as start directory again.
356+
To avoid scanning directories unrelated to Python,
357+
tests are not searched in subdirectories that do not contain ``__init__.py``.
365358

366359

367360
.. _organizing-tests:
@@ -1915,10 +1908,8 @@ Loading and running tests
19151908
Modules that raise :exc:`SkipTest` on import are recorded as skips,
19161909
not errors.
19171910

1918-
.. versionchanged:: 3.4
19191911
*start_dir* can be a :term:`namespace packages <namespace package>`.
19201912

1921-
.. versionchanged:: 3.4
19221913
Paths are sorted before being imported so that execution order is the
19231914
same even if the underlying file system's ordering is not dependent
19241915
on file name.
@@ -1930,11 +1921,13 @@ Loading and running tests
19301921

19311922
.. versionchanged:: 3.11
19321923
*start_dir* can not be a :term:`namespace packages <namespace package>`.
1933-
It has been broken since Python 3.7 and Python 3.11 officially remove it.
1924+
It has been broken since Python 3.7, and Python 3.11 officially removes it.
19341925

19351926
.. versionchanged:: 3.13
19361927
*top_level_dir* is only stored for the duration of *discover* call.
19371928

1929+
.. versionchanged:: 3.14
1930+
*start_dir* can once again be a :term:`namespace package`.
19381931

19391932
The following attributes of a :class:`TestLoader` can be configured either by
19401933
subclassing or assignment on an instance:

Doc/tools/extensions/pyspecific.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,5 +434,6 @@ def setup(app):
434434
app.add_directive_to_domain('py', 'awaitablemethod', PyAwaitableMethod)
435435
app.add_directive_to_domain('py', 'abstractmethod', PyAbstractMethod)
436436
app.add_directive('miscnews', MiscNews)
437+
app.add_css_file('sidebar-wrap.css')
437438
app.connect('env-check-consistency', patch_pairindextypes)
438439
return {'version': '1.0', 'parallel_read_safe': True}

Doc/tools/static/rtd_switcher.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
document.addEventListener("readthedocs-addons-data-ready", function(event) {
88
const config = event.detail.data()
99
const versionSelect = `
10-
<select id="version_select">
10+
<select id="version_select" aria-label="Python version">
1111
${ config.versions.active.map(
1212
(version) => `
1313
<option
@@ -25,7 +25,7 @@
2525
languages = languages.sort((a, b) => a.language.name.localeCompare(b.language.name));
2626

2727
const languageSelect = `
28-
<select id="language_select">
28+
<select id="language_select" aria-label="Language">
2929
${ languages.map(
3030
(translation) => `
3131
<option

Doc/tools/static/sidebar-wrap.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
div.sphinxsidebarwrapper {
2+
overflow-x: scroll;
3+
}
4+
div.sphinxsidebarwrapper li code {
5+
overflow-wrap: normal;
6+
}

Doc/tools/templates/indexcontent.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ <h1>{{ docstitle|e }}</h1>
5959
<table class="contentstable" align="center"><tr>
6060
<td width="50%">
6161
<p class="biglink"><a class="biglink" href="{{ pathto("bugs") }}">{% trans %}Reporting issues{% endtrans %}</a></p>
62-
<p class="biglink"><a class="biglink" href="https://devguide.python.org/docquality/#helping-with-documentation">{% trans %}Contributing to Docs{% endtrans %}</a></p>
62+
<p class="biglink"><a class="biglink" href="https://devguide.python.org/documentation/help-documenting/">{% trans %}Contributing to Docs{% endtrans %}</a></p>
6363
<p class="biglink"><a class="biglink" href="{{ pathto("download") }}">{% trans %}Download the documentation{% endtrans %}</a></p>
6464
</td><td width="50%">
6565
<p class="biglink"><a class="biglink" href="{{ pathto("license") }}">{% trans %}History and license of Python{% endtrans %}</a></p>

0 commit comments

Comments
 (0)