Skip to content

Delete EnumMeta.__setattr__ and EnumMeta.__delattr__ #7388

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
Feb 27, 2022
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: 3 additions & 1 deletion stdlib/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,17 @@ class object:
def __class__(self, __type: type[object]) -> None: ... # type: ignore # noqa: F811
def __init__(self) -> None: ...
def __new__(cls: type[Self]) -> Self: ...
# N.B. `object.__setattr__` and `object.__delattr__` are heavily special-cased by type checkers.
# Overriding them in subclasses has different semantics, even if the override has an identical signature.
def __setattr__(self, __name: str, __value: Any) -> None: ...
def __delattr__(self, __name: str) -> None: ...
def __eq__(self, __o: object) -> bool: ...
def __ne__(self, __o: object) -> bool: ...
def __str__(self) -> str: ... # noqa Y029
def __repr__(self) -> str: ... # noqa Y029
def __hash__(self) -> int: ...
def __format__(self, __format_spec: str) -> str: ...
def __getattribute__(self, __name: str) -> Any: ...
def __delattr__(self, __name: str) -> None: ...
def __sizeof__(self) -> int: ...
# return type of pickle methods is rather hard to express in the current type system
# see #6661 and https://docs.python.org/3/library/pickle.html#object.__reduce__
Expand Down
2 changes: 0 additions & 2 deletions stdlib/enum.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ class EnumMeta(ABCMeta):
def __members__(self: type[_EnumMemberT]) -> types.MappingProxyType[str, _EnumMemberT]: ...
def __len__(self) -> int: ...
def __bool__(self) -> Literal[True]: ...
def __setattr__(self, name: str, value: Any) -> None: ...
def __delattr__(self, name: str) -> None: ...
if sys.version_info >= (3, 11):
# Simple value lookup
@overload # type: ignore[override]
Expand Down