Repository navigation
Add __new__ to str and int stubs in both Pythons. - #1352
Conversation
JelleZijlstra
left a comment
There was a problem hiding this comment.
What concrete problem does this solve? I'm hesitant to change stubs as basic as these without a clear justification.
| @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.
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.