From a9f872bd8c63b6518d7cfc0beeba6dc04aff6daf Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 16 Nov 2026 20:02:22 +0100 Subject: [PATCH 1/2] [multiprocessing] ShareableList is iterable but has no __iter__ --- stdlib/multiprocessing/shared_memory.pyi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stdlib/multiprocessing/shared_memory.pyi b/stdlib/multiprocessing/shared_memory.pyi index 90777a4e771b..0ae05e3e2391 100644 --- a/stdlib/multiprocessing/shared_memory.pyi +++ b/stdlib/multiprocessing/shared_memory.pyi @@ -1,5 +1,5 @@ import sys -from collections.abc import Iterable +from collections.abc import Iterable, Iterator from types import GenericAlias from typing import Any, Generic, TypeVar, overload from typing_extensions import Self @@ -36,6 +36,7 @@ class ShareableList(Generic[_SLT]): def __setitem__(self, position: int, value: _SLT) -> None: ... def __reduce__(self) -> tuple[Self, tuple[_SLT, ...]]: ... def __len__(self) -> int: ... + def __iter__(self) -> Iterator[_SLT]: ... @property def format(self) -> str: ... def count(self, value: _SLT) -> int: ... From 2296aab5839ff73ad6d34fc48e9733d9cccf7397 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 16 Nov 2026 20:06:54 +0100 Subject: [PATCH 2/2] chore: allowlist `ShareableList.__iter__` in stubtest --- stdlib/@tests/stubtest_allowlists/common.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/stdlib/@tests/stubtest_allowlists/common.txt b/stdlib/@tests/stubtest_allowlists/common.txt index 2b758b24365b..006376528f43 100644 --- a/stdlib/@tests/stubtest_allowlists/common.txt +++ b/stdlib/@tests/stubtest_allowlists/common.txt @@ -300,6 +300,7 @@ logging.LogRecord.__setattr__ # doesn't exist, but makes things easy if we pret # These would ideally be special-cased by type checkers; see https://github.com/python/mypy/issues/2220 mmap.mmap.__iter__ mmap.mmap.__contains__ +multiprocessing.shared_memory.ShareableList.__iter__ # These multiprocessing proxy methods have *args, **kwargs signatures at runtime, # But have more precise (accurate) signatures in the stub