Skip to content

Commit 12c475b

Browse files
Merge branch 'main' into Eliminate-redunant-refcounting-from-TO_BOOL_ALWAYS_TRUE
2 parents a6cc9bb + 841b748 commit 12c475b

32 files changed

+361
-68
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,6 @@ jobs:
691691
- build-ubuntu
692692
- build-ubuntu-ssltests-awslc
693693
- build-ubuntu-ssltests-openssl
694-
- build-android
695694
- build-ios
696695
- build-wasi
697696
- test-hypothesis
@@ -706,6 +705,7 @@ jobs:
706705
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe
707706
with:
708707
allowed-failures: >-
708+
build-android,
709709
build-windows-msi,
710710
build-ubuntu-ssltests-awslc,
711711
build-ubuntu-ssltests-openssl,

Doc/deprecations/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Deprecations
77

88
.. include:: pending-removal-in-3.17.rst
99

10+
.. include:: pending-removal-in-3.18.rst
11+
1012
.. include:: pending-removal-in-3.19.rst
1113

1214
.. include:: pending-removal-in-3.20.rst
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Pending removal in Python 3.18
2+
------------------------------
3+
4+
* :mod:`decimal`:
5+
6+
* The non-standard and undocumented :class:`~decimal.Decimal` format
7+
specifier ``'N'``, which is only supported in the :mod:`!decimal` module's
8+
C implementation, has been deprecated since Python 3.13.
9+
(Contributed by Serhiy Storchaka in :gh:`89902`.)

Doc/library/compression.zstd.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Reading and writing compressed files
7373
argument is not None, a :exc:`!TypeError` will be raised.
7474

7575
When writing, the *options* argument can be a dictionary
76-
providing advanced decompression parameters; see
76+
providing advanced compression parameters; see
7777
:class:`CompressionParameter` for detailed information about supported
7878
parameters. The *level* argument is the compression level to use when
7979
writing compressed data. Only one of *level* or *options* may be non-None.
@@ -117,7 +117,7 @@ Reading and writing compressed files
117117
argument is not None, a :exc:`!TypeError` will be raised.
118118

119119
When writing, the *options* argument can be a dictionary
120-
providing advanced decompression parameters; see
120+
providing advanced compression parameters; see
121121
:class:`CompressionParameter` for detailed information about supported
122122
parameters. The *level* argument is the compression level to use when
123123
writing compressed data. Only one of *level* or *options* may be passed. The

Doc/library/importlib.metadata.rst

Lines changed: 72 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,16 @@ Distributions
418418
equal, even if they relate to the same installed distribution and
419419
accordingly have the same attributes.
420420

421+
.. method:: discover(cls, *, context=None, **kwargs)
422+
423+
Returns an iterable of :class:`Distribution` instances for all packages.
424+
425+
The optional argument *context* is a :class:`DistributionFinder.Context`
426+
instance, used to modify the search for distributions. Alternatively,
427+
*kwargs* may contain keyword arguments for constructing a new
428+
:class:`!DistributionFinder.Context`.
429+
430+
421431
While the module level API described above is the most common and convenient usage,
422432
you can get all of that information from the :class:`!Distribution` class.
423433
:class:`!Distribution` is an abstract object that represents the metadata for
@@ -466,6 +476,61 @@ This metadata finder search defaults to ``sys.path``, but varies slightly in how
466476
- ``importlib.metadata`` does not honor :class:`bytes` objects on ``sys.path``.
467477
- ``importlib.metadata`` will incidentally honor :py:class:`pathlib.Path` objects on ``sys.path`` even though such values will be ignored for imports.
468478

479+
.. class:: DistributionFinder
480+
481+
A :class:`~importlib.abc.MetaPathFinder` subclass capable of discovering
482+
installed distributions.
483+
484+
Custom providers should implement this interface in order to
485+
supply metadata.
486+
487+
.. class:: Context(**kwargs)
488+
489+
A :class:`!Context` gives a custom provider a means to
490+
solicit additional details from the callers of distribution discovery
491+
functions like :func:`distributions` or :meth:`Distribution.discover`
492+
beyond :attr:`!.name` and :attr:`!.path` when searching
493+
for distributions.
494+
495+
For example, a provider could expose suites of packages in either a
496+
"public" or "private" ``realm``. A caller of distribution discovery
497+
functions may wish to query only for distributions in a particular realm
498+
and could call ``distributions(realm="private")`` to signal to the
499+
custom provider to only include distributions from that
500+
realm.
501+
502+
Each :class:`!DistributionFinder` must expect any parameters and should
503+
attempt to honor the canonical parameters defined below when
504+
appropriate.
505+
506+
See the section on :ref:`implementing-custom-providers` for more details.
507+
508+
.. attribute:: name
509+
510+
Specific name for which a distribution finder should match.
511+
512+
A :attr:`!.name` of ``None`` matches all distributions.
513+
514+
.. attribute:: path
515+
516+
A property providing the sequence of directory paths that a
517+
distribution finder should search.
518+
519+
Typically refers to Python installed package paths such as
520+
"site-packages" directories and defaults to :attr:`sys.path`.
521+
522+
523+
.. function:: distributions(**kwargs)
524+
525+
Returns an iterable of :class:`Distribution` instances for all packages.
526+
527+
The *kwargs* argument may contain either a keyword argument ``context``, a
528+
:class:`DistributionFinder.Context` instance, or pass keyword arguments for
529+
constructing a new :class:`!DistributionFinder.Context`. The
530+
:class:`!DistributionFinder.Context` is used to modify the search for
531+
distributions.
532+
533+
.. _implementing-custom-providers:
469534

470535
Implementing Custom Providers
471536
=============================
@@ -493,7 +558,7 @@ interface expected of finders by Python's import system.
493558
``importlib.metadata`` extends this protocol by looking for an optional
494559
``find_distributions`` callable on the finders from
495560
:data:`sys.meta_path` and presents this extended interface as the
496-
``DistributionFinder`` abstract base class, which defines this abstract
561+
:class:`DistributionFinder` abstract base class, which defines this abstract
497562
method::
498563

499564
@abc.abstractmethod
@@ -502,9 +567,11 @@ method::
502567
loading the metadata for packages for the indicated ``context``.
503568
"""
504569

505-
The ``DistributionFinder.Context`` object provides ``.path`` and ``.name``
506-
properties indicating the path to search and name to match and may
507-
supply other relevant context sought by the consumer.
570+
The :class:`DistributionFinder.Context` object provides
571+
:attr:`~DistributionFinder.Context.path` and
572+
:attr:`~DistributionFinder.Context.name` properties indicating the path to
573+
search and name to match and may supply other relevant context sought by the
574+
consumer.
508575

509576
In practice, to support finding distribution package
510577
metadata in locations other than the file system, subclass
@@ -529,7 +596,7 @@ Imagine a custom finder that loads Python modules from a database::
529596
That importer now presumably provides importable modules from a
530597
database, but it provides no metadata or entry points. For this
531598
custom importer to provide metadata, it would also need to implement
532-
``DistributionFinder``::
599+
:class:`DistributionFinder`::
533600

534601
from importlib.metadata import DistributionFinder
535602

Doc/library/os.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,6 +1556,15 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
15561556
.. versionadded:: 3.15
15571557

15581558

1559+
.. data:: RWF_ATOMIC
1560+
1561+
Write data atomically. Requires alignment to the device's atomic write unit.
1562+
1563+
.. availability:: Linux >= 6.11
1564+
1565+
.. versionadded:: next
1566+
1567+
15591568
.. function:: ptsname(fd, /)
15601569

15611570
Return the name of the slave pseudo-terminal device associated with the
@@ -1598,6 +1607,7 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
15981607
- :data:`RWF_SYNC`
15991608
- :data:`RWF_APPEND`
16001609
- :data:`RWF_DONTCACHE`
1610+
- :data:`RWF_ATOMIC`
16011611

16021612
Return the total number of bytes actually written.
16031613

Doc/reference/datamodel.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2617,7 +2617,7 @@ Notes on using *__slots__*:
26172617
* :exc:`TypeError` will be raised if *__slots__* other than *__dict__* and
26182618
*__weakref__* are defined for a class derived from a
26192619
:c:member:`"variable-length" built-in type <PyTypeObject.tp_itemsize>` such as
2620-
:class:`int`, :class:`bytes`, and :class:`tuple`.
2620+
:class:`int`, :class:`bytes`, and :class:`type`, except :class:`tuple`.
26212621

26222622
* Any non-string :term:`iterable` may be assigned to *__slots__*.
26232623

@@ -2642,6 +2642,7 @@ Notes on using *__slots__*:
26422642

26432643
.. versionchanged:: 3.15
26442644
Allowed defining the *__dict__* and *__weakref__* *__slots__* for any class.
2645+
Allowed defining any *__slots__* for a class derived from :class:`tuple`.
26452646

26462647

26472648
.. _class-customization:

Doc/whatsnew/3.13.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1861,6 +1861,7 @@ New Deprecations
18611861
* Deprecate the non-standard and undocumented :class:`~decimal.Decimal`
18621862
format specifier ``'N'``,
18631863
which is only supported in the :mod:`!decimal` module's C implementation.
1864+
Scheduled to be removed in Python 3.18.
18641865
(Contributed by Serhiy Storchaka in :gh:`89902`.)
18651866

18661867
* :mod:`dis`:
@@ -2024,6 +2025,8 @@ New Deprecations
20242025

20252026
.. include:: ../deprecations/pending-removal-in-3.17.rst
20262027

2028+
.. include:: ../deprecations/pending-removal-in-3.18.rst
2029+
20272030
.. include:: ../deprecations/pending-removal-in-3.19.rst
20282031

20292032
.. include:: ../deprecations/pending-removal-in-3.20.rst

Doc/whatsnew/3.14.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2718,6 +2718,8 @@ New deprecations
27182718

27192719
.. include:: ../deprecations/pending-removal-in-3.17.rst
27202720

2721+
.. include:: ../deprecations/pending-removal-in-3.18.rst
2722+
27212723
.. include:: ../deprecations/pending-removal-in-3.19.rst
27222724

27232725
.. include:: ../deprecations/pending-removal-in-3.20.rst

Doc/whatsnew/3.15.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,10 @@ Other language changes
398398
for any class.
399399
(Contributed by Serhiy Storchaka in :gh:`41779`.)
400400

401+
* Allowed defining any :ref:`__slots__ <slots>` for a class derived from
402+
:class:`tuple` (including classes created by :func:`collections.namedtuple`).
403+
(Contributed by Serhiy Storchaka in :gh:`41779`.)
404+
401405

402406
New modules
403407
===========
@@ -1167,6 +1171,8 @@ New deprecations
11671171

11681172
.. include:: ../deprecations/pending-removal-in-3.17.rst
11691173

1174+
.. include:: ../deprecations/pending-removal-in-3.18.rst
1175+
11701176
.. include:: ../deprecations/pending-removal-in-3.19.rst
11711177

11721178
.. include:: ../deprecations/pending-removal-in-3.20.rst
@@ -1412,7 +1418,7 @@ that may require changes to your code.
14121418
:func:`resource.setrlimit` and :func:`resource.prlimit` is now deprecated.
14131419
(Contributed by Serhiy Storchaka in :gh:`137044`.)
14141420

1415-
* :meth:`~mmap.mmap.resize` has been removed on platforms that don't support the
1421+
* :meth:`mmap.mmap.resize` has been removed on platforms that don't support the
14161422
underlying syscall, instead of raising a :exc:`SystemError`.
14171423

14181424
* A resource warning is now emitted for an unclosed

0 commit comments

Comments
 (0)