-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
setuptools & distutils: ClassVar mutables (and tuples)
#12403
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
setuptools & distutils: ClassVar mutables (and tuples)
#12403
Conversation
srittau
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skimming through this: LGTM
This comment has been minimized.
This comment has been minimized.
|
mypy_primer looks like a true-positive due to runtime backwards compatibility (that requires a @srittau I reset your review since I included a few additional lines right afterward. |
This comment has been minimized.
This comment has been minimized.
stubs/setuptools/setuptools/msvc.pyi
Outdated
| class RegistryInfo: | ||
| HKEYS: Incomplete | ||
| if sys.platform == "win32": | ||
| HKEYS: ClassVar[tuple[int, int, int, int]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason not to use Final here? It would effectively interpreted as an immutable ClassVar here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be made Final. I doubt it's meant to be overridden by subclasses
This comment has been minimized.
This comment has been minimized.
|
Diff from mypy_primer, showing the effect of this PR on open source code: setuptools (https://github.com/pypa/setuptools)
+ setuptools/command/__init__.py:6: error: No overload variant of "__setitem__" of "list" matches argument types "str", "Tuple[str, str]" [call-overload]
+ setuptools/command/__init__.py:6: note: Possible overload variants:
+ setuptools/command/__init__.py:6: note: def __setitem__(self, SupportsIndex, str, /) -> None
+ setuptools/command/__init__.py:6: note: def __setitem__(self, slice, Iterable[str], /) -> None
|
Update the type for all class-level dicts, lists and tuples that I found.
Reduces changes in #12400
Reduces bare
Any(#9550)