Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Doc/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Glossary
:keyword:`yield` expression.

Each :keyword:`yield` temporarily suspends processing, remembering the
location execution state (including local variables and pending
execution state (including local variables and pending
try-statements). When the *asynchronous generator iterator* effectively
resumes with another awaitable returned by :meth:`~object.__anext__`, it
picks up where it left off. See :pep:`492` and :pep:`525`.
Expand Down Expand Up @@ -564,7 +564,7 @@ Glossary
An object created by a :term:`generator` function.

Each :keyword:`yield` temporarily suspends processing, remembering the
location execution state (including local variables and pending
execution state (including local variables and pending
try-statements). When the *generator iterator* resumes, it picks up where
it left off (in contrast to functions which start fresh on every
invocation).
Expand Down
4 changes: 3 additions & 1 deletion Lib/asyncio/base_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -1593,7 +1593,9 @@ async def create_server(
if reuse_address:
sock.setsockopt(
socket.SOL_SOCKET, socket.SO_REUSEADDR, True)
if reuse_port:
# Since Linux 6.12.9, SO_REUSEPORT is not allowed
# on other address families than AF_INET/AF_INET6.
if reuse_port and af in (socket.AF_INET, socket.AF_INET6):
_set_reuseport(sock)
if keep_alive:
sock.setsockopt(
Expand Down
3 changes: 2 additions & 1 deletion Lib/pydoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1435,7 +1435,8 @@ def makename(c, m=object.__module__):
# List the built-in subclasses, if any:
subclasses = sorted(
(str(cls.__name__) for cls in type.__subclasses__(object)
if not cls.__name__.startswith("_") and cls.__module__ == "builtins"),
if (not cls.__name__.startswith("_") and
getattr(cls, '__module__', '') == "builtins")),
key=str.lower
)
no_of_subclasses = len(subclasses)
Expand Down
4 changes: 3 additions & 1 deletion Lib/socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,9 @@ def create_server(address, *, family=AF_INET, backlog=None, reuse_port=False,
# Fail later on bind(), for platforms which may not
# support this option.
pass
if reuse_port:
# Since Linux 6.12.9, SO_REUSEPORT is not allowed
# on other address families than AF_INET/AF_INET6.
if reuse_port and family in (AF_INET, AF_INET6):
sock.setsockopt(SOL_SOCKET, SO_REUSEPORT, 1)
if has_ipv6 and family == AF_INET6:
if dualstack_ipv6:
Expand Down
7 changes: 6 additions & 1 deletion Lib/socketserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,12 @@ def server_bind(self):
"""
if self.allow_reuse_address and hasattr(socket, "SO_REUSEADDR"):
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
if self.allow_reuse_port and hasattr(socket, "SO_REUSEPORT"):
# Since Linux 6.12.9, SO_REUSEPORT is not allowed
# on other address families than AF_INET/AF_INET6.
if (
self.allow_reuse_port and hasattr(socket, "SO_REUSEPORT")
and self.address_family in (socket.AF_INET, socket.AF_INET6)
):
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
self.socket.bind(self.server_address)
self.server_address = self.socket.getsockname()
Expand Down
8 changes: 8 additions & 0 deletions Lib/test/test_pydoc/test_pydoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,14 @@ class object
| ... and 82 other subclasses
"""
doc = pydoc.TextDoc()
try:
# Make sure HeapType, which has no __module__ attribute, is one
# of the known subclasses of object. (doc.docclass() used to
# fail if HeapType was imported before running this test, like
# when running tests sequentially.)
from _testcapi import HeapType
except ImportError:
pass
text = doc.docclass(object)
snip = (" | Built-in subclasses:\n"
" | async_generator\n"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Do not attempt to set ``SO_REUSEPORT`` on sockets of address families
other than ``AF_INET`` and ``AF_INET6``, as it is meaningless with these
address families, and the call with fail with Linux kernel 6.12.9 and newer.
Loading