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
Add __new__
to str
and int
stubs in both Pythons.
#1352
Conversation
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.
What concrete problem does this solve? I'm hesitant to change stubs as basic as these without a clear justification.
stdlib/3/builtins.pyi
Outdated
@overload | ||
def __init__(self, x: SupportsInt = ...) -> None: ... | ||
@overload | ||
def __init__(self, x: Union[str, bytes], base: int = 10) -> None: ... |
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.
All defaults should be ...
.
We have the issue https://youtrack.jetbrains.com/issue/PY-23540 where we raise a warning on |
cae181d
to
565f07c
Compare
Not sure how to fix compatibility issue inside IntEnum :( |
Thanks, that makes sense. mypy also gives a spurious error on calling I don't have a great solution for the test failures either. We could |
…nd `str`. Add `__new__` to `enum.IntEnum` to override inherited `__new__`.
565f07c
to
c094dc6
Compare
c094dc6
to
08b2ac4
Compare
Fixed! |
Yes, this seems to work. I tested it on my codebase too and got no errors. I'll leave this open a few more days in case other maintainers have concerns, then merge it. |
Hm, mypy on the issue from the PyCharm tracker reports this, both with and without the change:
Other than that, no much difference. (Though I wonder what would happen if someone were to add |
No description provided.