Skip to content

Commit 64f4101

Browse files
Merge branch 'main' into fix-issue-34828
2 parents 4e573e9 + 8e08978 commit 64f4101

334 files changed

Lines changed: 4268 additions & 2541 deletions

File tree

Some content is hidden

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

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ Python/pythonrun.c @iritkatriel
6060
# bytecode.
6161
**/*import*.c @brettcannon @encukou @ericsnowcurrently @ncoghlan @warsaw
6262
**/*import*.py @brettcannon @encukou @ericsnowcurrently @ncoghlan @warsaw
63+
**/importlib/resources/* @jaraco @warsaw @brettcannon
64+
**/importlib/metadata/* @jaraco @warsaw
6365

6466
# Dates and times
6567
**/*datetime* @pganssle @abalkin

.github/workflows/doc.yml

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ on:
2323
paths:
2424
- 'Doc/**'
2525
- 'Misc/**'
26+
- '.github/workflows/doc.yml'
2627

2728
permissions:
2829
contents: read
@@ -35,6 +36,38 @@ jobs:
3536
- uses: actions/checkout@v3
3637
- name: Register Sphinx problem matcher
3738
run: echo "::add-matcher::.github/problem-matchers/sphinx.json"
39+
- name: 'Set up Python'
40+
uses: actions/setup-python@v4
41+
with:
42+
python-version: '3'
43+
cache: 'pip'
44+
cache-dependency-path: 'Doc/requirements.txt'
45+
- name: 'Install build dependencies'
46+
run: make -C Doc/ venv
47+
- name: 'Check documentation'
48+
run: make -C Doc/ check
49+
- name: 'Build HTML documentation'
50+
run: make -C Doc/ SPHINXOPTS="-q" SPHINXERRORHANDLING="-W --keep-going" html
51+
- name: 'Upload'
52+
uses: actions/upload-artifact@v3
53+
with:
54+
name: doc-html
55+
path: Doc/build/html
56+
57+
# Run "doctest" on HEAD as new syntax doesn't exist in the latest stable release
58+
doctest:
59+
name: 'Doctest'
60+
runs-on: ubuntu-latest
61+
steps:
62+
- uses: actions/checkout@v3
63+
- name: Register Sphinx problem matcher
64+
run: echo "::add-matcher::.github/problem-matchers/sphinx.json"
65+
- uses: actions/cache@v3
66+
with:
67+
path: ~/.cache/pip
68+
key: ubuntu-doc-${{ hashFiles('Doc/requirements.txt') }}
69+
restore-keys: |
70+
ubuntu-doc-
3871
- name: 'Install Dependencies'
3972
run: sudo ./.github/workflows/posix-deps-apt.sh && sudo apt-get install wamerican
4073
- name: 'Configure CPython'
@@ -43,17 +76,6 @@ jobs:
4376
run: make -j4
4477
- name: 'Install build dependencies'
4578
run: make -C Doc/ PYTHON=../python venv
46-
# Run "check doctest html" as 3 steps to get a more readable output
47-
# in the web UI
48-
- name: 'Check documentation'
49-
run: make -C Doc/ PYTHON=../python SPHINXOPTS="-q -W --keep-going" check
5079
# Use "xvfb-run" since some doctest tests open GUI windows
5180
- name: 'Run documentation doctest'
52-
run: xvfb-run make -C Doc/ PYTHON=../python SPHINXOPTS="-q -W --keep-going" doctest
53-
- name: 'Build HTML documentation'
54-
run: make -C Doc/ PYTHON=../python SPHINXOPTS="-q -W --keep-going" html
55-
- name: 'Upload'
56-
uses: actions/upload-artifact@v3
57-
with:
58-
name: doc-html
59-
path: Doc/build/html
81+
run: xvfb-run make -C Doc/ PYTHON=../python SPHINXOPTS="-q" SPHINXERRORHANDLING="-W --keep-going" doctest

Doc/c-api/sys.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ Operating System Utilities
2121
2222
Return true (nonzero) if the standard I/O file *fp* with name *filename* is
2323
deemed interactive. This is the case for files for which ``isatty(fileno(fp))``
24-
is true. If the global flag :c:data:`Py_InteractiveFlag` is true, this function
24+
is true. If the :c:member:`PyConfig.interactive` is non-zero, this function
2525
also returns true if the *filename* pointer is ``NULL`` or if the name is equal to
2626
one of the strings ``'<stdin>'`` or ``'???'``.
2727
28+
This function must not be called before Python is initialized.
29+
2830
2931
.. c:function:: void PyOS_BeforeFork()
3032

Doc/c-api/type.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,8 @@ The following functions and structs are used to create
296296
Array of :c:type:`PyType_Slot` structures.
297297
Terminated by the special slot value ``{0, NULL}``.
298298
299+
Each slot ID should be specified at most once.
300+
299301
.. c:type:: PyType_Slot
300302
301303
Structure defining optional functionality of a type, containing a slot ID

Doc/library/asyncio-llapi-index.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,10 @@ pipes, etc). Returned from methods like
358358

359359
* - :meth:`transport.get_write_buffer_size()
360360
<WriteTransport.get_write_buffer_size>`
361+
- Return the current size of the output buffer.
362+
363+
* - :meth:`transport.get_write_buffer_limits()
364+
<WriteTransport.get_write_buffer_limits>`
361365
- Return high and low water marks for write flow control.
362366

363367
* - :meth:`transport.set_write_buffer_limits()

Doc/library/cgi.rst

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
The :mod:`cgi` module is deprecated
2020
(see :pep:`PEP 594 <594#cgi>` for details and alternatives).
2121

22+
The :class:`FieldStorage` class can typically be replaced with
23+
:func:`urllib.parse.parse_qsl` for ``GET`` and ``HEAD`` requests,
24+
and the :mod:`email.message` module or
25+
`multipart <https://pypi.org/project/multipart/>`_ for ``POST`` and ``PUT``.
26+
Most :ref:`utility functions <functions-in-cgi-module>` have replacements.
27+
2228
--------------
2329

2430
Support module for Common Gateway Interface (CGI) scripts.
@@ -293,6 +299,12 @@ algorithms implemented in this module in other circumstances.
293299
``sys.stdin``). The *keep_blank_values*, *strict_parsing* and *separator* parameters are
294300
passed to :func:`urllib.parse.parse_qs` unchanged.
295301

302+
.. deprecated-removed:: 3.11 3.13
303+
This function, like the rest of the :mod:`cgi` module, is deprecated.
304+
It can be replaced by calling :func:`urllib.parse.parse_qs` directly
305+
on the desired query string (except for ``multipart/form-data`` input,
306+
which can be handled as described for :func:`parse_multipart`).
307+
296308

297309
.. function:: parse_multipart(fp, pdict, encoding="utf-8", errors="replace", separator="&")
298310

@@ -316,12 +328,31 @@ algorithms implemented in this module in other circumstances.
316328
.. versionchanged:: 3.10
317329
Added the *separator* parameter.
318330

331+
.. deprecated-removed:: 3.11 3.13
332+
This function, like the rest of the :mod:`cgi` module, is deprecated.
333+
It can be replaced with the functionality in the :mod:`email` package
334+
(e.g. :class:`email.message.EmailMessage`/:class:`email.message.Message`)
335+
which implements the same MIME RFCs, or with the
336+
`multipart <https://pypi.org/project/multipart/>`__ PyPI project.
337+
319338

320339
.. function:: parse_header(string)
321340

322341
Parse a MIME header (such as :mailheader:`Content-Type`) into a main value and a
323342
dictionary of parameters.
324343

344+
.. deprecated-removed:: 3.11 3.13
345+
This function, like the rest of the :mod:`cgi` module, is deprecated.
346+
It can be replaced with the functionality in the :mod:`email` package,
347+
which implements the same MIME RFCs.
348+
349+
For example, with :class:`email.message.EmailMessage`::
350+
351+
from email.message import EmailMessage
352+
msg = EmailMessage()
353+
msg['content-type'] = 'application/json; charset="utf8"'
354+
main, params = msg.get_content_type(), msg['content-type'].params
355+
325356

326357
.. function:: test()
327358

Doc/library/dis.rst

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,20 @@ iterations of the loop.
887887

888888
.. opcode:: LOAD_ATTR (namei)
889889

890-
Replaces TOS with ``getattr(TOS, co_names[namei])``.
890+
If the low bit of ``namei`` is not set, this replaces TOS with
891+
``getattr(TOS, co_names[namei>>1])``.
892+
893+
If the low bit of ``namei`` is set, this will attempt to load a method named
894+
``co_names[namei>>1]`` from the TOS object. TOS is popped.
895+
This bytecode distinguishes two cases: if TOS has a method with the correct
896+
name, the bytecode pushes the unbound method and TOS. TOS will be used as
897+
the first argument (``self``) by :opcode:`CALL` when calling the
898+
unbound method. Otherwise, ``NULL`` and the object return by the attribute
899+
lookup are pushed.
900+
901+
.. versionchanged:: 3.12
902+
If the low bit of ``namei`` is set, then a ``NULL`` or ``self`` is
903+
pushed to the stack before the attribute or unbound method respectively.
891904

892905

893906
.. opcode:: COMPARE_OP (opname)
@@ -1189,18 +1202,6 @@ iterations of the loop.
11891202
.. versionadded:: 3.6
11901203

11911204

1192-
.. opcode:: LOAD_METHOD (namei)
1193-
1194-
Loads a method named ``co_names[namei]`` from the TOS object. TOS is popped.
1195-
This bytecode distinguishes two cases: if TOS has a method with the correct
1196-
name, the bytecode pushes the unbound method and TOS. TOS will be used as
1197-
the first argument (``self``) by :opcode:`CALL` when calling the
1198-
unbound method. Otherwise, ``NULL`` and the object return by the attribute
1199-
lookup are pushed.
1200-
1201-
.. versionadded:: 3.7
1202-
1203-
12041205
.. opcode:: PUSH_NULL
12051206

12061207
Pushes a ``NULL`` to the stack.

Doc/library/os.path.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ the :mod:`glob` module.)
469469
("c:", "/dir")
470470

471471
If the path contains a UNC path, drive will contain the host name
472-
and share, up to but not including the fourth separator::
472+
and share::
473473

474474
>>> splitdrive("//host/computer/dir")
475475
("//host/computer", "/dir")

Doc/library/pathlib.rst

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,13 @@ we also call *flavours*:
133133
PureWindowsPath('c:/Program Files')
134134

135135
Spurious slashes and single dots are collapsed, but double dots (``'..'``)
136-
are not, since this would change the meaning of a path in the face of
137-
symbolic links::
136+
and leading double slashes (``'//'``) are not, since this would change the
137+
meaning of a path for various reasons (e.g. symbolic links, UNC paths)::
138138

139139
>>> PurePath('foo//bar')
140140
PurePosixPath('foo/bar')
141+
>>> PurePath('//foo/bar')
142+
PurePosixPath('//foo/bar')
141143
>>> PurePath('foo/./bar')
142144
PurePosixPath('foo/bar')
143145
>>> PurePath('foo/../bar')
@@ -166,13 +168,17 @@ we also call *flavours*:
166168
.. class:: PureWindowsPath(*pathsegments)
167169

168170
A subclass of :class:`PurePath`, this path flavour represents Windows
169-
filesystem paths::
171+
filesystem paths, including `UNC paths`_::
170172

171173
>>> PureWindowsPath('c:/Program Files/')
172174
PureWindowsPath('c:/Program Files')
175+
>>> PureWindowsPath('//server/share/file')
176+
PureWindowsPath('//server/share/file')
173177

174178
*pathsegments* is specified similarly to :class:`PurePath`.
175179

180+
.. _unc paths: https://en.wikipedia.org/wiki/Path_(computing)#UNC
181+
176182
Regardless of the system you're running on, you can instantiate all of
177183
these classes, since they don't provide any operation that does system calls.
178184

@@ -309,6 +315,27 @@ Pure paths provide the following methods and properties:
309315
>>> PureWindowsPath('//host/share').root
310316
'\\'
311317

318+
If the path starts with more than two successive slashes,
319+
:class:`~pathlib.PurePosixPath` collapses them::
320+
321+
>>> PurePosixPath('//etc').root
322+
'//'
323+
>>> PurePosixPath('///etc').root
324+
'/'
325+
>>> PurePosixPath('////etc').root
326+
'/'
327+
328+
.. note::
329+
330+
This behavior conforms to *The Open Group Base Specifications Issue 6*,
331+
paragraph `4.11 *Pathname Resolution* <xbd_path_resolution>`_:
332+
333+
*"A pathname that begins with two successive slashes may be interpreted in
334+
an implementation-defined manner, although more than two leading slashes
335+
shall be treated as a single slash."*
336+
337+
.. xbd_path_resolution: https://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap04.html#tag_04_11
338+
312339
.. data:: PurePath.anchor
313340

314341
The concatenation of the drive and root::

Doc/library/socket.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2076,10 +2076,10 @@ the interface::
20762076
# Include IP headers
20772077
s.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1)
20782078

2079-
# receive all packages
2079+
# receive all packets
20802080
s.ioctl(socket.SIO_RCVALL, socket.RCVALL_ON)
20812081

2082-
# receive a package
2082+
# receive a packet
20832083
print(s.recvfrom(65565))
20842084

20852085
# disabled promiscuous mode

0 commit comments

Comments
 (0)