Skip to content

Mark various dunder methods as positional-only in the stdlib #14528

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

Merged
merged 1 commit into from
Aug 5, 2025
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
2 changes: 1 addition & 1 deletion stdlib/_contextvars.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Token(Generic[_T]):
if sys.version_info >= (3, 14):
def __enter__(self) -> Self: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None, /
) -> None: ...

def copy_context() -> Context: ...
Expand Down
12 changes: 6 additions & 6 deletions stdlib/_interpchannels.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ class ChannelID:
def send(self) -> Self: ...
@property
def recv(self) -> Self: ...
def __eq__(self, other: object) -> bool: ...
def __ge__(self, other: ChannelID) -> bool: ...
def __gt__(self, other: ChannelID) -> bool: ...
def __eq__(self, other: object, /) -> bool: ...
def __ge__(self, other: ChannelID, /) -> bool: ...
def __gt__(self, other: ChannelID, /) -> bool: ...
def __hash__(self) -> int: ...
def __index__(self) -> int: ...
def __int__(self) -> int: ...
def __le__(self, other: ChannelID) -> bool: ...
def __lt__(self, other: ChannelID) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __le__(self, other: ChannelID, /) -> bool: ...
def __lt__(self, other: ChannelID, /) -> bool: ...
def __ne__(self, other: object, /) -> bool: ...

@final
class ChannelInfo(structseq[int], tuple[bool, bool, bool, int, int, int, int, int]):
Expand Down
1 change: 1 addition & 0 deletions stdlib/array.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class array(MutableSequence[_T]):
def tounicode(self) -> str: ...

__hash__: ClassVar[None] # type: ignore[assignment]
def __contains__(self, value: object, /) -> bool: ...
def __len__(self) -> int: ...
@overload
def __getitem__(self, key: SupportsIndex, /) -> _T: ...
Expand Down
2 changes: 1 addition & 1 deletion stdlib/importlib/metadata/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ class EntryPoint(_EntryPointBase):
) -> bool: ... # undocumented

def __hash__(self) -> int: ...
def __eq__(self, other: object) -> bool: ...
if sys.version_info >= (3, 11):
def __eq__(self, other: object) -> bool: ...
def __lt__(self, other: object) -> bool: ...
if sys.version_info < (3, 12):
def __iter__(self) -> Iterator[Any]: ... # result of iter((str, Self)), really
Expand Down
30 changes: 15 additions & 15 deletions stdlib/typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,12 @@ class TypeVar:
contravariant: bool = False,
) -> None: ...
if sys.version_info >= (3, 10):
def __or__(self, right: Any) -> _SpecialForm: ... # AnnotationForm
def __ror__(self, left: Any) -> _SpecialForm: ... # AnnotationForm
def __or__(self, right: Any, /) -> _SpecialForm: ... # AnnotationForm
def __ror__(self, left: Any, /) -> _SpecialForm: ... # AnnotationForm
if sys.version_info >= (3, 11):
def __typing_subst__(self, arg: Any) -> Any: ...
def __typing_subst__(self, arg: Any, /) -> Any: ...
if sys.version_info >= (3, 13):
def __typing_prepare_subst__(self, alias: Any, args: Any) -> tuple[Any, ...]: ...
def __typing_prepare_subst__(self, alias: Any, args: Any, /) -> tuple[Any, ...]: ...
def has_default(self) -> bool: ...
if sys.version_info >= (3, 14):
@property
Expand Down Expand Up @@ -273,8 +273,8 @@ if sys.version_info >= (3, 11):
def __init__(self, name: str) -> None: ...

def __iter__(self) -> Any: ...
def __typing_subst__(self, arg: Never) -> Never: ...
def __typing_prepare_subst__(self, alias: Any, args: Any) -> tuple[Any, ...]: ...
def __typing_subst__(self, arg: Never, /) -> Never: ...
def __typing_prepare_subst__(self, alias: Any, args: Any, /) -> tuple[Any, ...]: ...
if sys.version_info >= (3, 14):
@property
def evaluate_default(self) -> EvaluateFunc | None: ...
Expand All @@ -289,7 +289,7 @@ if sys.version_info >= (3, 10):
else:
def __init__(self, origin: ParamSpec) -> None: ...

def __eq__(self, other: object) -> bool: ...
def __eq__(self, other: object, /) -> bool: ...
__hash__: ClassVar[None] # type: ignore[assignment]

@final
Expand All @@ -301,7 +301,7 @@ if sys.version_info >= (3, 10):
else:
def __init__(self, origin: ParamSpec) -> None: ...

def __eq__(self, other: object) -> bool: ...
def __eq__(self, other: object, /) -> bool: ...
__hash__: ClassVar[None] # type: ignore[assignment]

@final
Expand Down Expand Up @@ -365,11 +365,11 @@ if sys.version_info >= (3, 10):
@property
def kwargs(self) -> ParamSpecKwargs: ...
if sys.version_info >= (3, 11):
def __typing_subst__(self, arg: Any) -> Any: ...
def __typing_prepare_subst__(self, alias: Any, args: Any) -> tuple[Any, ...]: ...
def __typing_subst__(self, arg: Any, /) -> Any: ...
def __typing_prepare_subst__(self, alias: Any, args: Any, /) -> tuple[Any, ...]: ...

def __or__(self, right: Any) -> _SpecialForm: ...
def __ror__(self, left: Any) -> _SpecialForm: ...
def __or__(self, right: Any, /) -> _SpecialForm: ...
def __ror__(self, left: Any, /) -> _SpecialForm: ...
if sys.version_info >= (3, 13):
def has_default(self) -> bool: ...
if sys.version_info >= (3, 14):
Expand Down Expand Up @@ -1115,9 +1115,9 @@ if sys.version_info >= (3, 12):
# It's writable on types, but not on instances of TypeAliasType.
@property
def __module__(self) -> str | None: ... # type: ignore[override]
def __getitem__(self, parameters: Any) -> GenericAlias: ... # AnnotationForm
def __or__(self, right: Any) -> _SpecialForm: ...
def __ror__(self, left: Any) -> _SpecialForm: ...
def __getitem__(self, parameters: Any, /) -> GenericAlias: ... # AnnotationForm
def __or__(self, right: Any, /) -> _SpecialForm: ...
def __ror__(self, left: Any, /) -> _SpecialForm: ...
if sys.version_info >= (3, 14):
@property
def evaluate_value(self) -> EvaluateFunc: ...
Expand Down
4 changes: 2 additions & 2 deletions stdlib/typing_extensions.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -593,8 +593,8 @@ else:
def __getitem__(self, parameters: Incomplete | tuple[Incomplete, ...]) -> AnnotationForm: ...
def __init_subclass__(cls, *args: Unused, **kwargs: Unused) -> NoReturn: ...
if sys.version_info >= (3, 10):
def __or__(self, right: Any) -> _SpecialForm: ...
def __ror__(self, left: Any) -> _SpecialForm: ...
def __or__(self, right: Any, /) -> _SpecialForm: ...
def __ror__(self, left: Any, /) -> _SpecialForm: ...

# PEP 727
class Doc:
Expand Down
2 changes: 1 addition & 1 deletion stdlib/winreg.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ if sys.platform == "win32":
def __int__(self) -> int: ...
def __enter__(self) -> Self: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None, /
) -> bool | None: ...
def Close(self) -> None: ...
def Detach(self) -> int: ...
Expand Down
Loading