Skip to content

Commit 2fca753

Browse files
committed
Merge branch 'main' into check-periodic-at-end
2 parents 021fc09 + 801cf3f commit 2fca753

File tree

159 files changed

+3459
-1051
lines changed

Some content is hidden

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

159 files changed

+3459
-1051
lines changed

.github/workflows/jit.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ jobs:
117117
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
118118
brew install llvm@${{ matrix.llvm }}
119119
export SDKROOT="$(xcrun --show-sdk-path)"
120+
# Set MACOSX_DEPLOYMENT_TARGET and -Werror=unguarded-availability to
121+
# make sure we don't break downstream distributors (like uv):
122+
export CFLAGS_JIT='-Werror=unguarded-availability'
123+
export MACOSX_DEPLOYMENT_TARGET=10.15
120124
./configure --enable-experimental-jit --enable-universalsdk --with-universal-archs=universal2 ${{ matrix.debug && '--with-pydebug' || '' }}
121125
make all --jobs 4
122126
./python.exe -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3

Doc/c-api/complex.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,36 @@ pointers. This is consistent throughout the API.
4343
Return the sum of two complex numbers, using the C :c:type:`Py_complex`
4444
representation.
4545
46+
.. deprecated:: 3.15
47+
This function is :term:`soft deprecated`.
48+
4649
4750
.. c:function:: Py_complex _Py_c_diff(Py_complex left, Py_complex right)
4851
4952
Return the difference between two complex numbers, using the C
5053
:c:type:`Py_complex` representation.
5154
55+
.. deprecated:: 3.15
56+
This function is :term:`soft deprecated`.
57+
5258
5359
.. c:function:: Py_complex _Py_c_neg(Py_complex num)
5460
5561
Return the negation of the complex number *num*, using the C
5662
:c:type:`Py_complex` representation.
5763
64+
.. deprecated:: 3.15
65+
This function is :term:`soft deprecated`.
66+
5867
5968
.. c:function:: Py_complex _Py_c_prod(Py_complex left, Py_complex right)
6069
6170
Return the product of two complex numbers, using the C :c:type:`Py_complex`
6271
representation.
6372
73+
.. deprecated:: 3.15
74+
This function is :term:`soft deprecated`.
75+
6476
6577
.. c:function:: Py_complex _Py_c_quot(Py_complex dividend, Py_complex divisor)
6678
@@ -70,6 +82,9 @@ pointers. This is consistent throughout the API.
7082
If *divisor* is null, this method returns zero and sets
7183
:c:data:`errno` to :c:macro:`!EDOM`.
7284
85+
.. deprecated:: 3.15
86+
This function is :term:`soft deprecated`.
87+
7388
7489
.. c:function:: Py_complex _Py_c_pow(Py_complex num, Py_complex exp)
7590
@@ -81,6 +96,19 @@ pointers. This is consistent throughout the API.
8196
8297
Set :c:data:`errno` to :c:macro:`!ERANGE` on overflows.
8398
99+
.. deprecated:: 3.15
100+
This function is :term:`soft deprecated`.
101+
102+
103+
.. c:function:: double _Py_c_abs(Py_complex num)
104+
105+
Return the absolute value of the complex number *num*.
106+
107+
Set :c:data:`errno` to :c:macro:`!ERANGE` on overflows.
108+
109+
.. deprecated:: 3.15
110+
This function is :term:`soft deprecated`.
111+
84112
85113
Complex Numbers as Python Objects
86114
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Doc/library/array.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ defined:
2424
+-----------+--------------------+-------------------+-----------------------+-------+
2525
| ``'u'`` | wchar_t | Unicode character | 2 | \(1) |
2626
+-----------+--------------------+-------------------+-----------------------+-------+
27-
| ``'w'`` | Py_UCS4 | Unicode character | 4 | |
27+
| ``'w'`` | Py_UCS4 | Unicode character | 4 | \(2) |
2828
+-----------+--------------------+-------------------+-----------------------+-------+
2929
| ``'h'`` | signed short | int | 2 | |
3030
+-----------+--------------------+-------------------+-----------------------+-------+
@@ -60,6 +60,9 @@ Notes:
6060
.. deprecated-removed:: 3.3 3.16
6161
Please migrate to ``'w'`` typecode.
6262

63+
(2)
64+
.. versionadded:: 3.13
65+
6366

6467
The actual representation of values is determined by the machine architecture
6568
(strictly speaking, by the C implementation). The actual size can be accessed

Doc/library/asyncio-eventloop.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,12 @@ Opening network connections
611611
to bind the socket locally. The *local_host* and *local_port*
612612
are looked up using :meth:`getaddrinfo`.
613613

614+
.. note::
615+
616+
On Windows, when using the proactor event loop with ``local_addr=None``,
617+
an :exc:`OSError` with :attr:`!errno.WSAEINVAL` will be raised
618+
when running it.
619+
614620
* *remote_addr*, if given, is a ``(remote_host, remote_port)`` tuple used
615621
to connect the socket to a remote address. The *remote_host* and
616622
*remote_port* are looked up using :meth:`getaddrinfo`.

Doc/library/asyncio-queue.rst

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,34 @@ Queue
102102

103103
.. method:: shutdown(immediate=False)
104104

105-
Shut down the queue, making :meth:`~Queue.get` and :meth:`~Queue.put`
105+
Put a :class:`Queue` instance into a shutdown mode.
106+
107+
The queue can no longer grow.
108+
Future calls to :meth:`~Queue.put` raise :exc:`QueueShutDown`.
109+
Currently blocked callers of :meth:`~Queue.put` will be unblocked
110+
and will raise :exc:`QueueShutDown` in the formerly blocked thread.
111+
112+
If *immediate* is false (the default), the queue can be wound
113+
down normally with :meth:`~Queue.get` calls to extract tasks
114+
that have already been loaded.
115+
116+
And if :meth:`~Queue.task_done` is called for each remaining task, a
117+
pending :meth:`~Queue.join` will be unblocked normally.
118+
119+
Once the queue is empty, future calls to :meth:`~Queue.get` will
106120
raise :exc:`QueueShutDown`.
107121

108-
By default, :meth:`~Queue.get` on a shut down queue will only
109-
raise once the queue is empty. Set *immediate* to true to make
110-
:meth:`~Queue.get` raise immediately instead.
122+
If *immediate* is true, the queue is terminated immediately.
123+
The queue is drained to be completely empty and the count
124+
of unfinished tasks is reduced by the number of tasks drained.
125+
If unfinished tasks is zero, callers of :meth:`~Queue.join`
126+
are unblocked. Also, blocked callers of :meth:`~Queue.get`
127+
are unblocked and will raise :exc:`QueueShutDown` because the
128+
queue is empty.
111129

112-
All blocked callers of :meth:`~Queue.put` and :meth:`~Queue.get`
113-
will be unblocked. If *immediate* is true, a task will be marked
114-
as done for each remaining item in the queue, which may unblock
115-
callers of :meth:`~Queue.join`.
130+
Use caution when using :meth:`~Queue.join` with *immediate* set
131+
to true. This unblocks the join even when no work has been done
132+
on the tasks, violating the usual invariant for joining a queue.
116133

117134
.. versionadded:: 3.13
118135

@@ -129,9 +146,6 @@ Queue
129146
call was received for every item that had been :meth:`~Queue.put`
130147
into the queue).
131148

132-
``shutdown(immediate=True)`` calls :meth:`task_done` for each
133-
remaining item in the queue.
134-
135149
Raises :exc:`ValueError` if called more times than there were
136150
items placed in the queue.
137151

Doc/library/bisect.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ method to determine whether a value has been found. Instead, the
2424
functions only call the :meth:`~object.__lt__` method and will return an insertion
2525
point between values in an array.
2626

27+
.. note::
28+
29+
The functions in this module are not thread-safe. If multiple threads
30+
concurrently use :mod:`bisect` functions on the same sequence, this
31+
may result in undefined behaviour. Likewise, if the provided sequence
32+
is mutated by a different thread while a :mod:`bisect` function
33+
is operating on it, the result is undefined. For example, using
34+
:py:func:`~bisect.insort_left` on the same list from multiple threads
35+
may result in the list becoming unsorted.
36+
2737
.. _bisect functions:
2838

2939
The following functions are provided:

Doc/library/calendar.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,14 @@ The :mod:`calendar` module exports the following data attributes:
501501
>>> list(calendar.month_name)
502502
['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
503503

504+
.. caution::
505+
506+
In locales with alternative month names forms, the :data:`!month_name` sequence
507+
may not be suitable when a month name stands by itself and not as part of a date.
508+
For instance, in Greek and in many Slavic and Baltic languages, :data:`!month_name`
509+
will produce the month in genitive case. Use :data:`standalone_month_name` for a form
510+
suitable for standalone use.
511+
504512

505513
.. data:: month_abbr
506514

@@ -512,6 +520,31 @@ The :mod:`calendar` module exports the following data attributes:
512520
>>> list(calendar.month_abbr)
513521
['', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
514522

523+
.. caution::
524+
525+
In locales with alternative month names forms, the :data:`!month_abbr` sequence
526+
may not be suitable when a month name stands by itself and not as part of a date.
527+
Use :data:`standalone_month_abbr` for a form suitable for standalone use.
528+
529+
530+
.. data:: standalone_month_name
531+
532+
A sequence that represents the months of the year in the current locale
533+
in the standalone form if the locale provides one. Else it is equivalent
534+
to :data:`month_name`.
535+
536+
.. versionadded:: next
537+
538+
539+
.. data:: standalone_month_abbr
540+
541+
A sequence that represents the abbreviated months of the year in the current
542+
locale in the standalone form if the locale provides one. Else it is
543+
equivalent to :data:`month_abbr`.
544+
545+
.. versionadded:: next
546+
547+
515548
.. data:: JANUARY
516549
FEBRUARY
517550
MARCH

Doc/library/codecs.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,6 +1483,36 @@ to :class:`bytes` mappings. They are not supported by :meth:`bytes.decode`
14831483
Restoration of the aliases for the binary transforms.
14841484

14851485

1486+
.. _standalone-codec-functions:
1487+
1488+
Standalone Codec Functions
1489+
^^^^^^^^^^^^^^^^^^^^^^^^^^
1490+
1491+
The following functions provide encoding and decoding functionality similar to codecs,
1492+
but are not available as named codecs through :func:`codecs.encode` or :func:`codecs.decode`.
1493+
They are used internally (for example, by :mod:`pickle`) and behave similarly to the
1494+
``string_escape`` codec that was removed in Python 3.
1495+
1496+
.. function:: codecs.escape_encode(input, errors=None)
1497+
1498+
Encode *input* using escape sequences. Similar to how :func:`repr` on bytes
1499+
produces escaped byte values.
1500+
1501+
*input* must be a :class:`bytes` object.
1502+
1503+
Returns a tuple ``(output, length)`` where *output* is a :class:`bytes`
1504+
object and *length* is the number of bytes consumed.
1505+
1506+
.. function:: codecs.escape_decode(input, errors=None)
1507+
1508+
Decode *input* from escape sequences back to the original bytes.
1509+
1510+
*input* must be a :term:`bytes-like object`.
1511+
1512+
Returns a tuple ``(output, length)`` where *output* is a :class:`bytes`
1513+
object and *length* is the number of bytes consumed.
1514+
1515+
14861516
.. _text-transforms:
14871517

14881518
Text Transforms

Doc/library/concurrent.futures.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,11 @@ that :class:`ProcessPoolExecutor` will not work in the interactive interpreter.
342342
Calling :class:`Executor` or :class:`Future` methods from a callable submitted
343343
to a :class:`ProcessPoolExecutor` will result in deadlock.
344344

345+
Note that the restrictions on functions and arguments needing to picklable as
346+
per :class:`multiprocessing.Process` apply when using :meth:`~Executor.submit`
347+
and :meth:`~Executor.map` on a :class:`ProcessPoolExecutor`. A function defined
348+
in a REPL or a lambda should not be expected to work.
349+
345350
.. class:: ProcessPoolExecutor(max_workers=None, mp_context=None, initializer=None, initargs=(), max_tasks_per_child=None)
346351

347352
An :class:`Executor` subclass that executes calls asynchronously using a pool

Doc/library/concurrent.interpreters.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ makes them similar to processes, but they still enjoy in-process
134134
efficiency, like threads.
135135

136136
All that said, interpreters do naturally support certain flavors of
137-
concurrency, as a powerful side effect of that isolation.
137+
concurrency.
138138
There's a powerful side effect of that isolation. It enables a
139139
different approach to concurrency than you can take with async or
140140
threads. It's a similar concurrency model to CSP or the actor model,

0 commit comments

Comments
 (0)