Skip to content

Commit d53c013

Browse files
committed
Merge remote-tracking branch 'cpython/main' into pythongh-99726
2 parents 64111f4 + 7bae15c commit d53c013

File tree

99 files changed

+1682
-1351
lines changed

Some content is hidden

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

99 files changed

+1682
-1351
lines changed

.github/CODEOWNERS

+3
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,6 @@ Lib/ast.py @isidentical
154154

155155
# pathlib
156156
**/*pathlib* @brettcannon
157+
158+
# zipfile.Path
159+
**/*zipfile/*_path.py @jaraco

Doc/Makefile

+24-4
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ PAPEROPT_letter = -D latex_elements.papersize=letterpaper
2121
ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees $(PAPEROPT_$(PAPER)) -j auto \
2222
$(SPHINXOPTS) $(SPHINXERRORHANDLING) . build/$(BUILDER) $(SOURCES)
2323

24-
.PHONY: help build html htmlhelp latex text texinfo epub changes linkcheck \
25-
coverage doctest pydoc-topics htmlview clean clean-venv venv dist check serve \
26-
autobuild-dev autobuild-dev-html autobuild-stable autobuild-stable-html
27-
24+
.PHONY: help
2825
help:
2926
@echo "Please use \`make <target>' where <target> is one of"
3027
@echo " clean to remove build files"
@@ -44,6 +41,7 @@ help:
4441
@echo " dist to create a \"dist\" directory with archived docs for download"
4542
@echo " check to run a check for frequent markup errors"
4643

44+
.PHONY: build
4745
build:
4846
-mkdir -p build
4947
# Look first for a Misc/NEWS file (building from a source release tarball
@@ -70,70 +68,85 @@ build:
7068
$(SPHINXBUILD) $(ALLSPHINXOPTS)
7169
@echo
7270

71+
.PHONY: html
7372
html: BUILDER = html
7473
html: build
7574
@echo "Build finished. The HTML pages are in build/html."
7675

76+
.PHONY: htmlhelp
7777
htmlhelp: BUILDER = htmlhelp
7878
htmlhelp: build
7979
@echo "Build finished; now you can run HTML Help Workshop with the" \
8080
"build/htmlhelp/pydoc.hhp project file."
8181

82+
.PHONY: latex
8283
latex: BUILDER = latex
8384
latex: build
8485
@echo "Build finished; the LaTeX files are in build/latex."
8586
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
8687
"run these through (pdf)latex."
8788

89+
.PHONY: text
8890
text: BUILDER = text
8991
text: build
9092
@echo "Build finished; the text files are in build/text."
9193

94+
.PHONY: texinfo
9295
texinfo: BUILDER = texinfo
9396
texinfo: build
9497
@echo "Build finished; the python.texi file is in build/texinfo."
9598
@echo "Run \`make info' in that directory to run it through makeinfo."
9699

100+
.PHONY: epub
97101
epub: BUILDER = epub
98102
epub: build
99103
@echo "Build finished; the epub files are in build/epub."
100104

105+
.PHONY: changes
101106
changes: BUILDER = changes
102107
changes: build
103108
@echo "The overview file is in build/changes."
104109

110+
.PHONY: linkcheck
105111
linkcheck: BUILDER = linkcheck
106112
linkcheck:
107113
@$(MAKE) build BUILDER=$(BUILDER) || { \
108114
echo "Link check complete; look for any errors in the above output" \
109115
"or in build/$(BUILDER)/output.txt"; \
110116
false; }
111117

118+
.PHONY: coverage
112119
coverage: BUILDER = coverage
113120
coverage: build
114121
@echo "Coverage finished; see c.txt and python.txt in build/coverage"
115122

123+
.PHONY: doctest
116124
doctest: BUILDER = doctest
117125
doctest:
118126
@$(MAKE) build BUILDER=$(BUILDER) || { \
119127
echo "Testing of doctests in the sources finished, look at the" \
120128
"results in build/doctest/output.txt"; \
121129
false; }
122130

131+
.PHONY: pydoc-topics
123132
pydoc-topics: BUILDER = pydoc-topics
124133
pydoc-topics: build
125134
@echo "Building finished; now run this:" \
126135
"cp build/pydoc-topics/topics.py ../Lib/pydoc_data/topics.py"
127136

137+
.PHONY: htmlview
128138
htmlview: html
129139
$(PYTHON) -c "import os, webbrowser; webbrowser.open('file://' + os.path.realpath('build/html/index.html'))"
130140

141+
.PHONY: clean
131142
clean: clean-venv
132143
-rm -rf build/*
133144

145+
.PHONY: clean-venv
134146
clean-venv:
135147
rm -rf $(VENVDIR)
136148

149+
.PHONY: venv
137150
venv:
138151
@if [ -d $(VENVDIR) ] ; then \
139152
echo "venv already exists."; \
@@ -145,6 +158,7 @@ venv:
145158
echo "The venv has been created in the $(VENVDIR) directory"; \
146159
fi
147160

161+
.PHONY: dist
148162
dist:
149163
rm -rf dist
150164
mkdir -p dist
@@ -199,12 +213,14 @@ dist:
199213
rm -r dist/python-$(DISTVERSION)-docs-texinfo
200214
rm dist/python-$(DISTVERSION)-docs-texinfo.tar
201215

216+
.PHONY: check
202217
check:
203218
# Check the docs and NEWS files with sphinx-lint.
204219
# Ignore the tools and venv dirs and check that the default role is not used.
205220
$(SPHINXLINT) -i tools -i $(VENVDIR) --enable default-role
206221
$(SPHINXLINT) --enable default-role ../Misc/NEWS.d/next/
207222

223+
.PHONY: serve
208224
serve:
209225
@echo "The serve target was removed, use htmlview instead (see bpo-36329)"
210226

@@ -216,22 +232,26 @@ serve:
216232
# output files)
217233

218234
# for development releases: always build
235+
.PHONY: autobuild-dev
219236
autobuild-dev:
220237
make dist SPHINXOPTS='$(SPHINXOPTS) -Ea -A daily=1'
221238

222239
# for quick rebuilds (HTML only)
240+
.PHONY: autobuild-dev-html
223241
autobuild-dev-html:
224242
make html SPHINXOPTS='$(SPHINXOPTS) -Ea -A daily=1'
225243

226244
# for stable releases: only build if not in pre-release stage (alpha, beta)
227245
# release candidate downloads are okay, since the stable tree can be in that stage
246+
.PHONY: autobuild-stable
228247
autobuild-stable:
229248
@case $(DISTVERSION) in *[ab]*) \
230249
echo "Not building; $(DISTVERSION) is not a release version."; \
231250
exit 1;; \
232251
esac
233252
@make autobuild-dev
234253

254+
.PHONY: autobuild-stable-html
235255
autobuild-stable-html:
236256
@case $(DISTVERSION) in *[ab]*) \
237257
echo "Not building; $(DISTVERSION) is not a release version."; \

Doc/c-api/typeobj.rst

+25-6
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,16 @@ Quick Reference
149149
+------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
150150

151151
.. [#slots]
152-
A slot name in parentheses indicates it is (effectively) deprecated.
153-
Names in angle brackets should be treated as read-only.
154-
Names in square brackets are for internal use only.
155-
"<R>" (as a prefix) means the field is required (must be non-``NULL``).
152+
153+
**()**: A slot name in parentheses indicates it is (effectively) deprecated.
154+
155+
**<>**: Names in angle brackets should be initially set to ``NULL`` and
156+
treated as read-only.
157+
158+
**[]**: Names in square brackets are for internal use only.
159+
160+
**<R>** (as a prefix) means the field is required (must be non-``NULL``).
161+
156162
.. [#cols] Columns:
157163
158164
**"O"**: set on :c:type:`PyBaseObject_Type`
@@ -1923,8 +1929,19 @@ and :c:type:`PyType_Type` effectively act as defaults.)
19231929
19241930
Tuple of base types.
19251931

1926-
This is set for types created by a class statement. It should be ``NULL`` for
1927-
statically defined types.
1932+
This field should be set to ``NULL`` and treated as read-only.
1933+
Python will fill it in when the type is :c:func:`initialized <PyType_Ready>`.
1934+
1935+
For dynamically created classes, the ``Py_tp_bases``
1936+
:c:type:`slot <PyType_Slot>` can be used instead of the *bases* argument
1937+
of :c:func:`PyType_FromSpecWithBases`.
1938+
The argument form is preferred.
1939+
1940+
.. warning::
1941+
1942+
Multiple inheritance does not work well for statically defined types.
1943+
If you set ``tp_bases`` to a tuple, Python will not raise an error,
1944+
but some slots will only be inherited from the first base.
19281945

19291946
**Inheritance:**
19301947

@@ -1936,6 +1953,8 @@ and :c:type:`PyType_Type` effectively act as defaults.)
19361953
Tuple containing the expanded set of base types, starting with the type itself
19371954
and ending with :class:`object`, in Method Resolution Order.
19381955

1956+
This field should be set to ``NULL`` and treated as read-only.
1957+
Python will fill it in when the type is :c:func:`initialized <PyType_Ready>`.
19391958

19401959
**Inheritance:**
19411960

Doc/data/refcounts.dat

+2-2
Original file line numberDiff line numberDiff line change
@@ -1018,10 +1018,10 @@ PyImport_Import:PyObject*::+1:
10181018
PyImport_Import:PyObject*:name:0:
10191019

10201020
PyImport_ImportFrozenModule:int:::
1021-
PyImport_ImportFrozenModule:const char*:::
1021+
PyImport_ImportFrozenModule:const char*:name::
10221022

10231023
PyImport_ImportFrozenModuleObject:int:::
1024-
PyImport_ImportFrozenModuleObject:PyObject*::+1:
1024+
PyImport_ImportFrozenModuleObject:PyObject*:name:+1:
10251025

10261026
PyImport_ImportModule:PyObject*::+1:
10271027
PyImport_ImportModule:const char*:name::

Doc/library/ctypes.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -1440,8 +1440,8 @@ copy of the windows error code.
14401440

14411441
The *winmode* parameter is used on Windows to specify how the library is loaded
14421442
(since *mode* is ignored). It takes any value that is valid for the Win32 API
1443-
``LoadLibraryEx`` flags parameter. When omitted, the default is to use the flags
1444-
that result in the most secure DLL load to avoiding issues such as DLL
1443+
``LoadLibraryEx`` flags parameter. When omitted, the default is to use the
1444+
flags that result in the most secure DLL load, which avoids issues such as DLL
14451445
hijacking. Passing the full path to the DLL is the safest way to ensure the
14461446
correct library and dependencies are loaded.
14471447

Doc/library/doctest.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -696,10 +696,10 @@ special Python comments following an example's source code:
696696

697697
.. productionlist:: doctest
698698
directive: "#" "doctest:" `directive_options`
699-
directive_options: `directive_option` ("," `directive_option`)\*
699+
directive_options: `directive_option` ("," `directive_option`)*
700700
directive_option: `on_or_off` `directive_option_name`
701-
on_or_off: "+" \| "-"
702-
directive_option_name: "DONT_ACCEPT_BLANKLINE" \| "NORMALIZE_WHITESPACE" \| ...
701+
on_or_off: "+" | "-"
702+
directive_option_name: "DONT_ACCEPT_BLANKLINE" | "NORMALIZE_WHITESPACE" | ...
703703

704704
Whitespace is not allowed between the ``+`` or ``-`` and the directive option
705705
name. The directive option name can be any of the option flag names explained

Doc/library/importlib.resources.abc.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145
:class:`importlib.resources.abc.ResourceReader` and provides
146146
concrete implementations of the :class:`importlib.resources.abc.ResourceReader`'s
147147
abstract methods. Therefore, any loader supplying
148-
:class:`importlib.abc.TraversableReader` also supplies ResourceReader.
148+
:class:`importlib.abc.TraversableResources` also supplies ResourceReader.
149149

150150
Loaders that wish to support resource reading are expected to
151151
implement this interface.

Doc/library/importlib.resources.rst

+11-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,17 @@
1111
.. versionadded:: 3.7
1212

1313
This module leverages Python's import system to provide access to *resources*
14-
within *packages*. If you can import a package, you can access resources
15-
within that package. Resources can be opened or read, in either binary or
16-
text mode.
14+
within *packages*.
15+
16+
"Resources" are file-like resources associated with a module or package in
17+
Python. The resources may be contained directly in a package or within a
18+
subdirectory contained in that package. Resources may be text or binary. As a
19+
result, Python module sources (.py) of a package and compilation artifacts
20+
(pycache) are technically de-facto resources of that package. In practice,
21+
however, resources are primarily those non-Python artifacts exposed
22+
specifically by the package author.
23+
24+
Resources can be opened or read in either binary or text mode.
1725

1826
Resources are roughly akin to files inside directories, though it's important
1927
to keep in mind that this is just a metaphor. Resources and packages **do

Doc/library/inspect.rst

+1-6
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,14 @@ The :func:`getmembers` function retrieves the members of an object such as a
3232
class or module. The functions whose names begin with "is" are mainly
3333
provided as convenient choices for the second argument to :func:`getmembers`.
3434
They also help you determine when you can expect to find the following special
35-
attributes:
35+
attributes (see :ref:`import-mod-attrs` for module attributes):
3636

3737
.. this function name is too big to fit in the ascii-art table below
3838
.. |coroutine-origin-link| replace:: :func:`sys.set_coroutine_origin_tracking_depth`
3939

4040
+-----------+-------------------+---------------------------+
4141
| Type | Attribute | Description |
4242
+===========+===================+===========================+
43-
| module | __doc__ | documentation string |
44-
+-----------+-------------------+---------------------------+
45-
| | __file__ | filename (missing for |
46-
| | | built-in modules) |
47-
+-----------+-------------------+---------------------------+
4843
| class | __doc__ | documentation string |
4944
+-----------+-------------------+---------------------------+
5045
| | __name__ | name with which this |

Doc/library/multiprocessing.rst

+6-2
Original file line numberDiff line numberDiff line change
@@ -1089,10 +1089,14 @@ Miscellaneous
10891089
.. versionchanged:: 3.11
10901090
Accepts a :term:`path-like object`.
10911091

1092-
.. function:: set_start_method(method)
1092+
.. function:: set_start_method(method, force=False)
10931093

10941094
Set the method which should be used to start child processes.
1095-
*method* can be ``'fork'``, ``'spawn'`` or ``'forkserver'``.
1095+
The *method* argument can be ``'fork'``, ``'spawn'`` or ``'forkserver'``.
1096+
Raises :exc:`RuntimeError` if the start method has already been set and *force*
1097+
is not ``True``. If *method* is ``None`` and *force* is ``True`` then the start
1098+
method is set to ``None``. If *method* is ``None`` and *force* is ``False``
1099+
then the context is set to the default context.
10961100

10971101
Note that this should be called at most once, and it should be
10981102
protected inside the ``if __name__ == '__main__'`` clause of the

0 commit comments

Comments
 (0)