The documentation explaining Python's data model does not adequately explain
the differences between ``__getitem__`` and ``__class_getitem__``, nor does it
explain when each is called. There is an attempt at explaining
``__class_getitem__`` in the documentation for ``GenericAlias`` objects, but
this does not give sufficient clarity into how the method works. Moreover, it
is the wrong place for that information to be found; the explanation of
``__class_getitem__`` should be in the documentation explaining the data model.
This PR has been split off from GH-29335.
(cherry picked from commit 31b3a70edb)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Accessing one enum member from another originally raised an `AttributeError`, but became possible due to a performance boost implementation detail. In 3.11 it will again raise an `AttributeError`.
I was reading this bit last night and thought it was a typo. In the light of day, I realized it wasn't *technically* a typo, but definitely confusing wording. This PR fixes the confusing sentence.
Automerge-Triggered-By: GH:ericvsmith
(cherry picked from commit f8da00ef04)
Co-authored-by: Jack DeVries <jdevries3133@gmail.com>
* [bpo-45772](): socket.socket should be a class instead of a function
Currently `socket.socket` is documented as a function, but it is really
a class (and thus has function-like usage to construct an object). This
correction would ensure that Python projects that are interlinking
Python's documentation can properly locate `socket.socket` as a type.
(cherry picked from commit 4c792f39e6)
Co-authored-by: Hong Xu <hong@topbug.net>
Automerge-Triggered-By: GH:asvetlov
Since `.. module:: contextvars` sets the module using `.. class:: contextvars.Token`, intersphinx records it as `contextvars.contextvars.Token`.
(cherry picked from commit e501d70b34)
Co-authored-by: Hynek Schlawack <hs@ox.cx>
Co-authored-by: Hynek Schlawack <hs@ox.cx>
``typing.Tuple`` has been deprecated since Python 3.9, so it makes no sense to mention it so prominently in the documentation for the ``typing`` module.
(cherry picked from commit 87032cfa3d)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Specify that SSLContext.set_default_verify_paths is called on ALL systems.
The code of SSLContext.load_default_certs was changed in bpo-22449 to do this,
this fix corrects the documentation to match that change.
(cherry picked from commit 3551bf16ee)
Co-authored-by: LincolnPuzey <lincoln@puzey.dev>
* bpo-45516: add protocol description to the Traversable documentation
Signed-off-by: Filipe Laíns <lains@riseup.net>
* Update Doc/library/importlib.rst
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* Update Lib/importlib/abc.py
* Update Doc/library/importlib.rst
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
(cherry picked from commit 4d03de3329)
Co-authored-by: Filipe Laíns <filipe.lains@gmail.com>
The link broke for Python 3.10 since importlib.metadata was made from a module into a package
I think this is trivial enough to not need a bpo issue.
Automerge-Triggered-By: GH:jaraco
(cherry picked from commit aae18a1740)
Co-authored-by: Philipp A <flying-sheep@web.de>
The list of PEPs at the top of the documentation for the ``typing`` module has
become too long to be readable. This PR proposes presenting this
information in a more structured and readable way by adding a new "relevant
PEPs" section to the ``typing`` docs.
(cherry picked from commit 03db1bbfd2)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
(cherry picked from commit 0a68b3603f)
Co-authored-by: Justinas Petuchovas <justinas.petuchovas@gmail.com>
* add availability info to AF_PACKET section
* add availability for AF_QIPCRTR as well
(cherry picked from commit 51375388be)
Co-authored-by: andrei kulakov <andrei.avk@gmail.com>
We should have done this way back when 3.9 was released, but it fell off
the radar.
Co-authored-by: Paul Ganssle <git@m.ganssle.io>
(cherry picked from commit 8e40ca127f)
Document that the "standalone" parameter was added in Python 3.9.
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
(cherry picked from commit c7e81fcf95)
Co-authored-by: Jens Diemer <github.com@jensdiemer.de>
This is true of all dictionaries in Python, but this one tends to
catch people off guard as they don't realize when sys.modules might
change out from underneath them as a hidden side effect of their
code. Copying it first avoids the RuntimeError. An example when
this happens in single threaded code are codecs being loaded which
are an implicit time of use import that most need not think about.
(cherry picked from commit 3d1ca867ed)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
It took me longer than I expected to figure out why a random class
I dealt with didn't support weak references. I believe this addition
will make the __slots__/weakref interaction more discoverable to people
having troubles with this. (Before this patch __slots__ was not
mentioned in weakref documentation even once).
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit b24b47e643)
Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
It seems part of `gethostbyname_ex` doc was copied from `gethostbyaddr`. The latter has an `ip_address` parameter whereas the former doesn't.
(cherry picked from commit 4103280b83)
Co-authored-by: Andre Delfino <adelfino@gmail.com>