Skip to content

inheritance for multiprocessing.managers.BaseListProxy #12892

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
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
1 change: 0 additions & 1 deletion stdlib/@tests/stubtest_allowlists/common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,6 @@ inspect.Signature.empty # set as private marker _empty

# These multiprocessing proxy methods have *args, **kwargs signatures at runtime,
# But have more precise (accurate) signatures in the stub
multiprocessing.managers.BaseListProxy.__imul__
multiprocessing.managers.BaseListProxy.__len__
multiprocessing.managers.BaseListProxy.__reversed__
multiprocessing.managers.BaseListProxy.reverse
Expand Down
11 changes: 7 additions & 4 deletions stdlib/multiprocessing/managers.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import queue
import sys
import threading
from _typeshed import Incomplete, SupportsKeysAndGetItem, SupportsRichComparison, SupportsRichComparisonT
from collections.abc import Callable, Iterable, Iterator, Mapping, MutableMapping, MutableSequence, Sequence
from collections.abc import Callable, Iterable, Iterator, Mapping, MutableMapping, Sequence
from types import TracebackType
from typing import Any, AnyStr, ClassVar, Generic, SupportsIndex, TypeVar, overload
from typing_extensions import Self, TypeAlias
Expand Down Expand Up @@ -86,10 +86,11 @@ class DictProxy(BaseProxy, MutableMapping[_KT, _VT]):
if sys.version_info >= (3, 13):
def __class_getitem__(cls, args: Any, /) -> Any: ...

class BaseListProxy(BaseProxy, MutableSequence[_T]):
class BaseListProxy(BaseProxy, Generic[_T]):
__builtins__: ClassVar[dict[str, Any]]
def __len__(self) -> int: ...
def __add__(self, x: list[_T], /) -> list[_T]: ...
def __contains__(self, value: object, /) -> bool: ...
def __delitem__(self, i: SupportsIndex | slice, /) -> None: ...
@overload
def __getitem__(self, i: SupportsIndex, /) -> _T: ...
Expand All @@ -99,6 +100,7 @@ class BaseListProxy(BaseProxy, MutableSequence[_T]):
def __setitem__(self, i: SupportsIndex, o: _T, /) -> None: ...
@overload
def __setitem__(self, s: slice, o: Iterable[_T], /) -> None: ...
def __imul__(self, value: SupportsIndex, /) -> Self: ...
def __mul__(self, n: SupportsIndex, /) -> list[_T]: ...
def __rmul__(self, n: SupportsIndex, /) -> list[_T]: ...
def __reversed__(self) -> Iterator[_T]: ...
Expand All @@ -109,6 +111,7 @@ class BaseListProxy(BaseProxy, MutableSequence[_T]):
def count(self, value: _T, /) -> int: ...
def insert(self, index: SupportsIndex, object: _T, /) -> None: ...
def remove(self, value: _T, /) -> None: ...
def reverse(self) -> None: ...
# Use BaseListProxy[SupportsRichComparisonT] for the first overload rather than [SupportsRichComparison]
# to work around invariance
@overload
Expand All @@ -117,8 +120,8 @@ class BaseListProxy(BaseProxy, MutableSequence[_T]):
def sort(self, *, key: Callable[[_T], SupportsRichComparison], reverse: bool = ...) -> None: ...

class ListProxy(BaseListProxy[_T]):
def __iadd__(self, value: Iterable[_T], /) -> Self: ... # type: ignore[override]
def __imul__(self, value: SupportsIndex, /) -> Self: ... # type: ignore[override]
def __iadd__(self, value: Iterable[_T]) -> Self: ... # type: ignore[override]
def __imul__(self, value: SupportsIndex) -> Self: ... # type: ignore[override]
if sys.version_info >= (3, 13):
def __class_getitem__(cls, args: Any, /) -> Any: ...

Expand Down
Loading