Skip to content

Commit b5edb6f

Browse files
authored
Merge branch 'main' into 81719-zipfile-refactor-for-subclass
2 parents 7be0dab + 1612dcb commit b5edb6f

File tree

107 files changed

+1936
-845
lines changed

Some content is hidden

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

107 files changed

+1936
-845
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/c-api/object.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ Object Protocol
197197
in favour of using :c:func:`PyObject_DelAttr`, but there are currently no
198198
plans to remove it.
199199
200-
The function must not be called with ``NULL`` *v* and an an exception set.
200+
The function must not be called with a ``NULL`` *v* and an exception set.
201201
This case can arise from forgetting ``NULL`` checks and would delete the
202202
attribute.
203203
@@ -214,7 +214,7 @@ Object Protocol
214214
If *v* is ``NULL``, the attribute is deleted, but this feature is
215215
deprecated in favour of using :c:func:`PyObject_DelAttrString`.
216216
217-
The function must not be called with ``NULL`` *v* and an an exception set.
217+
The function must not be called with a ``NULL`` *v* and an exception set.
218218
This case can arise from forgetting ``NULL`` checks and would delete the
219219
attribute.
220220

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/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/heapq.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,42 @@ Heap elements can be tuples. This is useful for assigning comparison values
231231
(1, 'write spec')
232232

233233

234+
Other Applications
235+
------------------
236+
237+
`Medians <https://en.wikipedia.org/wiki/Median>`_ are a measure of
238+
central tendency for a set of numbers. In distributions skewed by
239+
outliers, the median provides a more stable estimate than an average
240+
(arithmetic mean). A running median is an `online algorithm
241+
<https://en.wikipedia.org/wiki/Online_algorithm>`_ that updates
242+
continuously as new data arrives.
243+
244+
A running median can be efficiently implemented by balancing two heaps,
245+
a max-heap for values at or below the midpoint and a min-heap for values
246+
above the midpoint. When the two heaps have the same size, the new
247+
median is the average of the tops of the two heaps; otherwise, the
248+
median is at the top of the larger heap::
249+
250+
def running_median(iterable):
251+
"Yields the cumulative median of values seen so far."
252+
253+
lo = [] # max-heap
254+
hi = [] # min-heap (same size as or one smaller than lo)
255+
256+
for x in iterable:
257+
if len(lo) == len(hi):
258+
heappush_max(lo, heappushpop(hi, x))
259+
yield lo[0]
260+
else:
261+
heappush(hi, heappushpop_max(lo, x))
262+
yield (lo[0] + hi[0]) / 2
263+
264+
For example::
265+
266+
>>> list(running_median([5.0, 9.0, 4.0, 12.0, 8.0, 9.0]))
267+
[5.0, 7.0, 5.0, 7.0, 8.0, 8.5]
268+
269+
234270
Priority Queue Implementation Notes
235271
-----------------------------------
236272

Doc/library/os.path.rst

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,8 @@ the :mod:`glob` module.)
424424
re-raised.
425425
In particular, :exc:`FileNotFoundError` is raised if *path* does not exist,
426426
or another :exc:`OSError` if it is otherwise inaccessible.
427+
If *strict* is :data:`ALL_BUT_LAST`, the last component of the path
428+
is allowed to be missing, but all other errors are raised.
427429

428430
If *strict* is :py:data:`os.path.ALLOW_MISSING`, errors other than
429431
:exc:`FileNotFoundError` are re-raised (as with ``strict=True``).
@@ -448,15 +450,22 @@ the :mod:`glob` module.)
448450
The *strict* parameter was added.
449451

450452
.. versionchanged:: next
451-
The :py:data:`~os.path.ALLOW_MISSING` value for the *strict* parameter
452-
was added.
453+
The :data:`ALL_BUT_LAST` and :data:`ALLOW_MISSING` values for
454+
the *strict* parameter was added.
455+
456+
.. data:: ALL_BUT_LAST
457+
458+
Special value used for the *strict* argument in :func:`realpath`.
459+
460+
.. versionadded:: next
453461

454462
.. data:: ALLOW_MISSING
455463

456464
Special value used for the *strict* argument in :func:`realpath`.
457465

458466
.. versionadded:: next
459467

468+
460469
.. function:: relpath(path, start=os.curdir)
461470

462471
Return a relative filepath to *path* either from the current directory or

Doc/library/tulip_coro.dia

-4.35 KB
Binary file not shown.

Doc/library/tulip_coro.png

-35.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)