Skip to content

Commit d22463b

Browse files
author
Carl Meyer
committed
Merge branch 'main' into dictwatch
* main: (94 commits) Revert "bpo-46986: Upgrade bundled setuptools to 60.9.3 (GH-31820)" (GH-31879) bpo-30677: [doc] mention that os.mkdir() can raise FileNotFoundError (GH-31548) git ignore Lib/site-packages (GH-31862) bpo-31415: importtime was made by Inada Naoki (GH-31875) bpo-46920: Remove code that has explainers why it was disabled (GH-31813) bpo-46920: Remove disabled debug code added decades ago and likely unnecessary (GH-31812) bpo-46920: Remove code that has no explainer why it was disabled (GH-31814) bpo-46906: Mention native endian in PyFloat_Pack8() doc (GH-31866) bpo-40280: select: Use NULL for empty fdset (GH-31865) CI: Fix patchcheck (GH-31708) bpo-46987: Remove _PySys_GetObjectId / _PySys_GetObjectId (GH-31835) bpo-46994: Accept explicit contextvars.Context in asyncio create_task() API (GH-31837) bpo-39829: Fix `__len__()` is called twice in list() constructor (GH-31816) bpo-47003: Cleanup _overlapped module (GH-31848) bpo-47004: Sync with importlib_metadata 4.11.3. (#31854) bpo-46986: Upgrade bundled setuptools to 60.9.3 (GH-31820) bpo-46985: Upgrade bundled pip to 22.0.4 (GH-31819) bpo-46805: Add low level UDP socket functions to asyncio (GH-31455) bpo-46995: Deprecate missing asyncio.Task.set_name() for third-party task implementations (GH-31838) bpo-43215: Document Happy Eyeballs args of asyncio.open_connection (GH-24525) ...
2 parents 886ab4f + 19f6999 commit d22463b

File tree

429 files changed

+8068
-2805
lines changed

Some content is hidden

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

429 files changed

+8068
-2805
lines changed

.azure-pipelines/posix-steps.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ steps:
6666
COMMAND: make
6767

6868
- ${{ if eq(parameters.patchcheck, 'true') }}:
69-
- script: ./python Tools/scripts/patchcheck.py --ci true
69+
- script: |
70+
git fetch origin
71+
./python Tools/scripts/patchcheck.py --ci true
7072
displayName: 'Run patchcheck.py'
7173
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
7274

.github/CODEOWNERS

+10-16
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ Python/traceback.c @iritkatriel
3232
Python/pythonrun.c @iritkatriel
3333

3434
# Hashing
35-
**/*hashlib* @python/crypto-team @tiran
36-
**/*pyhash* @python/crypto-team @tiran
37-
**/*sha* @python/crypto-team @tiran
38-
**/*md5* @python/crypto-team @tiran
39-
**/*blake* @python/crypto-team @tiran
40-
/Modules/_blake2/** @python/crypto-team @tiran
41-
/Modules/_sha3/** @python/crypto-team @tiran
35+
**/*hashlib* @tiran
36+
**/*pyhash* @tiran
37+
**/*sha* @tiran
38+
**/*md5* @tiran
39+
**/*blake* @tiran
40+
/Modules/_blake2/** @tiran
41+
/Modules/_sha3/** @tiran
4242

4343
# logging
4444
**/*logging* @vsajip
@@ -61,14 +61,6 @@ Python/pythonrun.c @iritkatriel
6161
**/*import*.c @brettcannon @encukou @ericsnowcurrently @ncoghlan @warsaw
6262
**/*import*.py @brettcannon @encukou @ericsnowcurrently @ncoghlan @warsaw
6363

64-
65-
# SSL
66-
**/*ssl* @python/crypto-team
67-
**/*.pem @python/crypto-team
68-
69-
# CSPRNG
70-
Python/bootstrap_hash.c @python/crypto-team
71-
7264
# Dates and times
7365
**/*datetime* @pganssle @abalkin
7466
**/*str*time* @pganssle @abalkin
@@ -132,7 +124,7 @@ Lib/ast.py @isidentical
132124
**/*bisect* @rhettinger
133125
**/*heapq* @rhettinger
134126
**/*functools* @rhettinger
135-
**/*decimal* @rhettinger @skrah
127+
**/*decimal* @rhettinger
136128

137129
**/*dataclasses* @ericvsmith
138130

@@ -149,6 +141,8 @@ Lib/ast.py @isidentical
149141
**/*cgi* @ethanfurman
150142
**/*tarfile* @ethanfurman
151143

144+
**/*tomllib* @encukou
145+
152146
# macOS
153147
/Mac/ @python/macos-team
154148
**/*osx_support* @python/macos-team

.github/workflows/build.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,14 @@ jobs:
7474
grep "aclocal 1.16.3" aclocal.m4
7575
grep -q "runstatedir" configure
7676
grep -q "PKG_PROG_PKG_CONFIG" aclocal.m4
77-
- name: Regenerate autoconf files
78-
run: docker run --rm -v $(pwd):/src quay.io/tiran/cpython_autoconf:269
79-
- name: Build CPython
77+
- name: Configure CPython
8078
run: |
8179
# Build Python with the libpython dynamic library
8280
./configure --with-pydebug --enable-shared
81+
- name: Regenerate autoconf files with container image
82+
run: make regen-configure
83+
- name: Build CPython
84+
run: |
8385
make -j4 regen-all
8486
make regen-stdlib-module-names
8587
- name: Check for changes

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ Doc/.env/
5858
Include/pydtrace_probes.h
5959
Lib/distutils/command/*.pdb
6060
Lib/lib2to3/*.pickle
61+
Lib/site-packages/*
62+
!Lib/site-packages/README.txt
6163
Lib/test/data/*
6264
!Lib/test/data/README
6365
/_bootstrap_python
@@ -75,6 +77,7 @@ Mac/pythonw
7577
Misc/python.pc
7678
Misc/python-embed.pc
7779
Misc/python-config.sh
80+
Modules/Setup.bootstrap
7881
Modules/Setup.config
7982
Modules/Setup.local
8083
Modules/Setup.stdlib

Doc/c-api/float.rst

+86
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,89 @@ Floating Point Objects
7676
.. c:function:: double PyFloat_GetMin()
7777
7878
Return the minimum normalized positive float *DBL_MIN* as C :c:type:`double`.
79+
80+
81+
Pack and Unpack functions
82+
=========================
83+
84+
The pack and unpack functions provide an efficient platform-independent way to
85+
store floating-point values as byte strings. The Pack routines produce a bytes
86+
string from a C :c:type:`double`, and the Unpack routines produce a C
87+
:c:type:`double` from such a bytes string. The suffix (2, 4 or 8) specifies the
88+
number of bytes in the bytes string.
89+
90+
On platforms that appear to use IEEE 754 formats these functions work by
91+
copying bits. On other platforms, the 2-byte format is identical to the IEEE
92+
754 binary16 half-precision format, the 4-byte format (32-bit) is identical to
93+
the IEEE 754 binary32 single precision format, and the 8-byte format to the
94+
IEEE 754 binary64 double precision format, although the packing of INFs and
95+
NaNs (if such things exist on the platform) isn't handled correctly, and
96+
attempting to unpack a bytes string containing an IEEE INF or NaN will raise an
97+
exception.
98+
99+
On non-IEEE platforms with more precision, or larger dynamic range, than IEEE
100+
754 supports, not all values can be packed; on non-IEEE platforms with less
101+
precision, or smaller dynamic range, not all values can be unpacked. What
102+
happens in such cases is partly accidental (alas).
103+
104+
.. versionadded:: 3.11
105+
106+
Pack functions
107+
--------------
108+
109+
The pack routines write 2, 4 or 8 bytes, starting at *p*. *le* is an
110+
:c:type:`int` argument, non-zero if you want the bytes string in little-endian
111+
format (exponent last, at ``p+1``, ``p+3``, or ``p+6`` ``p+7``), zero if you
112+
want big-endian format (exponent first, at *p*). The :c:data:`PY_BIG_ENDIAN`
113+
constant can be used to use the native endian: it is equal to ``1`` on big
114+
endian processor, or ``0`` on little endian processor.
115+
116+
Return value: ``0`` if all is OK, ``-1`` if error (and an exception is set,
117+
most likely :exc:`OverflowError`).
118+
119+
There are two problems on non-IEEE platforms:
120+
121+
* What this does is undefined if *x* is a NaN or infinity.
122+
* ``-0.0`` and ``+0.0`` produce the same bytes string.
123+
124+
.. c:function:: int PyFloat_Pack2(double x, unsigned char *p, int le)
125+
126+
Pack a C double as the IEEE 754 binary16 half-precision format.
127+
128+
.. c:function:: int PyFloat_Pack4(double x, unsigned char *p, int le)
129+
130+
Pack a C double as the IEEE 754 binary32 single precision format.
131+
132+
.. c:function:: int PyFloat_Pack8(double x, unsigned char *p, int le)
133+
134+
Pack a C double as the IEEE 754 binary64 double precision format.
135+
136+
137+
Unpack functions
138+
----------------
139+
140+
The unpack routines read 2, 4 or 8 bytes, starting at *p*. *le* is an
141+
:c:type:`int` argument, non-zero if the bytes string is in little-endian format
142+
(exponent last, at ``p+1``, ``p+3`` or ``p+6`` and ``p+7``), zero if big-endian
143+
(exponent first, at *p*). The :c:data:`PY_BIG_ENDIAN` constant can be used to
144+
use the native endian: it is equal to ``1`` on big endian processor, or ``0``
145+
on little endian processor.
146+
147+
Return value: The unpacked double. On error, this is ``-1.0`` and
148+
:c:func:`PyErr_Occurred` is true (and an exception is set, most likely
149+
:exc:`OverflowError`).
150+
151+
Note that on a non-IEEE platform this will refuse to unpack a bytes string that
152+
represents a NaN or infinity.
153+
154+
.. c:function:: double PyFloat_Unpack2(const unsigned char *p, int le)
155+
156+
Unpack the IEEE 754 binary16 half-precision format as a C double.
157+
158+
.. c:function:: double PyFloat_Unpack4(const unsigned char *p, int le)
159+
160+
Unpack the IEEE 754 binary32 single precision format as a C double.
161+
162+
.. c:function:: double PyFloat_Unpack8(const unsigned char *p, int le)
163+
164+
Unpack the IEEE 754 binary64 double precision format as a C double.

Doc/library/asyncio-eventloop.rst

+44-2
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ Creating Futures and Tasks
330330

331331
.. versionadded:: 3.5.2
332332

333-
.. method:: loop.create_task(coro, *, name=None)
333+
.. method:: loop.create_task(coro, *, name=None, context=None)
334334

335335
Schedule the execution of a :ref:`coroutine`.
336336
Return a :class:`Task` object.
@@ -342,17 +342,24 @@ Creating Futures and Tasks
342342
If the *name* argument is provided and not ``None``, it is set as
343343
the name of the task using :meth:`Task.set_name`.
344344

345+
An optional keyword-only *context* argument allows specifying a
346+
custom :class:`contextvars.Context` for the *coro* to run in.
347+
The current context copy is created when no *context* is provided.
348+
345349
.. versionchanged:: 3.8
346350
Added the *name* parameter.
347351

352+
.. versionchanged:: 3.11
353+
Added the *context* parameter.
354+
348355
.. method:: loop.set_task_factory(factory)
349356

350357
Set a task factory that will be used by
351358
:meth:`loop.create_task`.
352359

353360
If *factory* is ``None`` the default task factory will be set.
354361
Otherwise, *factory* must be a *callable* with the signature matching
355-
``(loop, coro)``, where *loop* is a reference to the active
362+
``(loop, coro, context=None)``, where *loop* is a reference to the active
356363
event loop, and *coro* is a coroutine object. The callable
357364
must return a :class:`asyncio.Future`-compatible object.
358365

@@ -922,6 +929,29 @@ convenient.
922929

923930
.. versionadded:: 3.7
924931

932+
.. coroutinemethod:: loop.sock_recvfrom(sock, bufsize)
933+
934+
Receive a datagram of up to *bufsize* from *sock*. Asynchronous version of
935+
:meth:`socket.recvfrom() <socket.socket.recvfrom>`.
936+
937+
Return a tuple of (received data, remote address).
938+
939+
*sock* must be a non-blocking socket.
940+
941+
.. versionadded:: 3.11
942+
943+
.. coroutinemethod:: loop.sock_recvfrom_into(sock, buf, nbytes=0)
944+
945+
Receive a datagram of up to *nbytes* from *sock* into *buf*.
946+
Asynchronous version of
947+
:meth:`socket.recvfrom_into() <socket.socket.recvfrom_into>`.
948+
949+
Return a tuple of (number of bytes received, remote address).
950+
951+
*sock* must be a non-blocking socket.
952+
953+
.. versionadded:: 3.11
954+
925955
.. coroutinemethod:: loop.sock_sendall(sock, data)
926956

927957
Send *data* to the *sock* socket. Asynchronous version of
@@ -940,6 +970,18 @@ convenient.
940970
method, before Python 3.7 it returned a :class:`Future`.
941971
Since Python 3.7, this is an ``async def`` method.
942972

973+
.. coroutinemethod:: loop.sock_sendto(sock, data, address)
974+
975+
Send a datagram from *sock* to *address*.
976+
Asynchronous version of
977+
:meth:`socket.sendto() <socket.socket.sendto>`.
978+
979+
Return the number of bytes sent.
980+
981+
*sock* must be a non-blocking socket.
982+
983+
.. versionadded:: 3.11
984+
943985
.. coroutinemethod:: loop.sock_connect(sock, address)
944986

945987
Connect *sock* to a remote socket at *address*.

Doc/library/asyncio-llapi-index.rst

+9
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,18 @@ See also the main documentation section about the
189189
* - ``await`` :meth:`loop.sock_recv_into`
190190
- Receive data from the :class:`~socket.socket` into a buffer.
191191

192+
* - ``await`` :meth:`loop.sock_recvfrom`
193+
- Receive a datagram from the :class:`~socket.socket`.
194+
195+
* - ``await`` :meth:`loop.sock_recvfrom_into`
196+
- Receive a datagram from the :class:`~socket.socket` into a buffer.
197+
192198
* - ``await`` :meth:`loop.sock_sendall`
193199
- Send data to the :class:`~socket.socket`.
194200

201+
* - ``await`` :meth:`loop.sock_sendto`
202+
- Send a datagram via the :class:`~socket.socket` to the given address.
203+
195204
* - ``await`` :meth:`loop.sock_connect`
196205
- Connect the :class:`~socket.socket`.
197206

Doc/library/asyncio-stream.rst

+5-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ and work with streams:
5151
.. coroutinefunction:: open_connection(host=None, port=None, *, \
5252
limit=None, ssl=None, family=0, proto=0, \
5353
flags=0, sock=None, local_addr=None, \
54-
server_hostname=None, ssl_handshake_timeout=None)
54+
server_hostname=None, ssl_handshake_timeout=None, \
55+
happy_eyeballs_delay=None, interleave=None)
5556

5657
Establish a network connection and return a pair of
5758
``(reader, writer)`` objects.
@@ -69,6 +70,9 @@ and work with streams:
6970
.. versionchanged:: 3.7
7071
Added the *ssl_handshake_timeout* parameter.
7172

73+
.. versionadded:: 3.8
74+
Added *happy_eyeballs_delay* and *interleave* parameters.
75+
7276
.. versionchanged:: 3.10
7377
Removed the *loop* parameter.
7478

Doc/library/asyncio-task.rst

+8-1
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,18 @@ Running an asyncio Program
244244
Creating Tasks
245245
==============
246246

247-
.. function:: create_task(coro, *, name=None)
247+
.. function:: create_task(coro, *, name=None, context=None)
248248

249249
Wrap the *coro* :ref:`coroutine <coroutine>` into a :class:`Task`
250250
and schedule its execution. Return the Task object.
251251

252252
If *name* is not ``None``, it is set as the name of the task using
253253
:meth:`Task.set_name`.
254254

255+
An optional keyword-only *context* argument allows specifying a
256+
custom :class:`contextvars.Context` for the *coro* to run in.
257+
The current context copy is created when no *context* is provided.
258+
255259
The task is executed in the loop returned by :func:`get_running_loop`,
256260
:exc:`RuntimeError` is raised if there is no running loop in
257261
current thread.
@@ -281,6 +285,9 @@ Creating Tasks
281285
.. versionchanged:: 3.8
282286
Added the *name* parameter.
283287

288+
.. versionchanged:: 3.11
289+
Added the *context* parameter.
290+
284291

285292
Sleeping
286293
========

Doc/library/fileformats.rst

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ that aren't markup languages and are not related to e-mail.
1212

1313
csv.rst
1414
configparser.rst
15+
tomllib.rst
1516
netrc.rst
1617
xdrlib.rst
1718
plistlib.rst

Doc/library/importlib.metadata.rst

+1-3
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ Python packages or modules::
264264

265265
.. versionadded:: 3.10
266266

267+
.. _distributions:
267268

268269
Distributions
269270
=============
@@ -335,6 +336,3 @@ a custom finder, return instances of this derived ``Distribution`` in the
335336
.. _`entry point API`: https://setuptools.readthedocs.io/en/latest/pkg_resources.html#entry-points
336337
.. _`metadata API`: https://setuptools.readthedocs.io/en/latest/pkg_resources.html#metadata-api
337338
.. _`importlib_resources`: https://importlib-resources.readthedocs.io/en/latest/index.html
338-
339-
340-
.. rubric:: Footnotes

Doc/library/math.rst

+3
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,9 @@ Constants
649649
A floating-point "not a number" (NaN) value. Equivalent to the output of
650650
``float('nan')``.
651651

652+
.. versionchanged:: 3.11
653+
It is now always available.
654+
652655
.. versionadded:: 3.5
653656

654657

Doc/library/os.rst

+5-1
Original file line numberDiff line numberDiff line change
@@ -2050,7 +2050,8 @@ features:
20502050

20512051
Create a directory named *path* with numeric mode *mode*.
20522052

2053-
If the directory already exists, :exc:`FileExistsError` is raised.
2053+
If the directory already exists, :exc:`FileExistsError` is raised. If a parent
2054+
directory in the path does not exist, :exc:`FileNotFoundError` is raised.
20542055

20552056
.. _mkdir_modebits:
20562057

@@ -4755,6 +4756,9 @@ Miscellaneous System Information
47554756

47564757
.. availability:: Unix.
47574758

4759+
.. versionchanged:: 3.11
4760+
Add ``'SC_MINSIGSTKSZ'`` name.
4761+
47584762
The following data values are used to support path manipulation operations. These
47594763
are defined for all platforms.
47604764

0 commit comments

Comments
 (0)