Uh oh!
There was an error while loading. Please reload this page.
gh-129758: Correct imports in Lib/_pyrepl - #129761
Conversation
sobolevn
left a comment
There was a problem hiding this comment.
I agree that changing if False to TYPE_CHECKING = False; if TYPE_CHECKING makes sense, because mypy better understands the second version.
See https://mypy-play.net/?mypy=latest&python=3.12&flags=strict%2Cwarn-unreachable&gist=ba9b71e677d20a0b4c1f78c731c0c0ea for if False:
main.py:4: error: Statement is unreachable [unreachable]
And see https://mypy-play.net/?mypy=latest&python=3.12&flags=strict%2Cwarn-unreachable&gist=c84fabb19a5b4a92b6eee9656b978baa for if TYPE_CHECKING:
Succeeded!! (3383 ms)
So, basically - changing if False -> if TYPE_CHECKING is required to enable warn_unreachable = true.
But, I am against changing anything else. Let's no refactor other places, like moving imports or renaming things. It will just create more friction for no gain.
Uh oh!
There was an error while loading. Please reload this page.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
it's probably worth leaving the removal of I also removed And the last one I removed importctypes# so i removed this import
...
fromctypesimportStructure
...
classCHAR_INFO(Structure):
...
classKeyEvent(ctypes.Structure): # and fix here: ctypes.Structure -> Structure
... |
donbarbos
commented
Feb 7, 2025
I have made the requested changes; please review again |
Thanks for making the requested changes! @sobolevn: please review the changes made to this pull request. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| *, | ||
| future_flags: int = 0, | ||
| ) -> None: | ||
| from .readline import _setup |
There was a problem hiding this comment.
@sobolevn ok, but why? We already have import _setup on 34 line
There was a problem hiding this comment.
In general, the default position is the status quo, you need to justify every change.
There was a problem hiding this comment.
I removed it because it duplicates imports. As I already said it is on line 34
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: sobolevn <mail@sobolevn.me>
There was a problem hiding this comment.
I agree that changing if False to TYPE_CHECKING = False; if TYPE_CHECKING makes sense, because mypy better understands the second version.
@sobolevn is it feasible to add a config option to mypy to have it recognise if False as the same as if TYPE_CHECKING?
We have the same idiom in several places, and if it leaks further then we will have a lot of useless module-level constants, whereas if False is optimised away by the interpreter. I'd prefer to wait for mypy to release a new version with this new option, rather than to change code here needlessly (it also attracts a lot of low value contributions because "<tool> has warnings" etc).
A
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
donbarbos
commented
Feb 7, 2025
I have made the requested changes; please review again |
Thanks for making the requested changes! @sobolevn, @AA-Turner: please review the changes made to this pull request. |
ambv
commented
Mar 20, 2025
Thanks, but we won't be taking this. This is churn. |
Lib/_pyrepl#129758