From 79c03ac0015ccf1cbb759f870e2af9d68f60fe3a Mon Sep 17 00:00:00 2001 From: Thanos <111999343+Sachaa-Thanasius@users.noreply.github.com> Date: Tue, 30 Dec 2025 00:16:54 -0500 Subject: [PATCH 1/2] gh-69686: Remove untrue part of `__import__` replacement docs (#143261) Remove untrue part of `__import__` replacement docs The original statement effectively says that replacing `__import__` at global scope affects import statements, and not only that, but only import statements within the rest of the executing module. None of that has been true since at least Python 2.7, I think. This was likely missed in python/cpython#69686. --- Doc/reference/import.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Doc/reference/import.rst b/Doc/reference/import.rst index f50d02a0ef03b9..83f0ee75e7aebd 100644 --- a/Doc/reference/import.rst +++ b/Doc/reference/import.rst @@ -832,9 +832,7 @@ entirely with a custom meta path hook. If it is acceptable to only alter the behaviour of import statements without affecting other APIs that access the import system, then replacing -the builtin :func:`__import__` function may be sufficient. This technique -may also be employed at the module level to only alter the behaviour of -import statements within that module. +the builtin :func:`__import__` function may be sufficient. To selectively prevent the import of some modules from a hook early on the meta path (rather than disabling the standard import system entirely), From ef834dee89d5b9413366db4cc519b015c51b5cb9 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Tue, 30 Dec 2025 06:23:30 +0100 Subject: [PATCH 2/2] gh-128546: Document that getaddrinfo() can return raw data (#128547) Document that getaddrinfo() can return raw data This is the case for IPv6 addresses if Python was compiled with --disable-ipv6. --- Doc/library/socket.rst | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst index 743d768bfa1f49..b7115942d1fdd1 100644 --- a/Doc/library/socket.rst +++ b/Doc/library/socket.rst @@ -1072,10 +1072,16 @@ The :mod:`socket` module also offers various network-related services: a string representing the canonical name of the *host* if :const:`AI_CANONNAME` is part of the *flags* argument; else *canonname* will be empty. *sockaddr* is a tuple describing a socket address, whose - format depends on the returned *family* (a ``(address, port)`` 2-tuple for - :const:`AF_INET`, a ``(address, port, flowinfo, scope_id)`` 4-tuple for - :const:`AF_INET6`), and is meant to be passed to the :meth:`socket.connect` - method. + format depends on the returned *family* and flags Python was compiled with, + and is meant to be passed to the :meth:`socket.connect` method. + + *sockaddr* can be one of the following: + + * a ``(address, port)`` 2-tuple for :const:`AF_INET` + * a ``(address, port, flowinfo, scope_id)`` 4-tuple for :const:`AF_INET6` if + Python was compiled with ``--enable-ipv6`` (the default) + * a 2-tuple containing raw data for :const:`AF_INET6` if Python was + compiled with ``--disable-ipv6`` .. note::