Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
gh-129758: Correct imports in Lib/_pyrepl#129761
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
donbarbos commented Feb 7, 2025 • edited by bedevere-app bot
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by bedevere-app bot
Uh oh!
There was an error while loading. Please reload this page.
sobolevn 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.
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 |
donbarbos commented Feb 7, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
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. |
sobolevn left a comment • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
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've left several suggestions to minimize the final diff. Every line counts 😉
We should be very careful about what we change and what we don't change.
Thank you!
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 .readlineimport_setup |
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.
Please, don't change this line.
donbarbosFeb 7, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
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.
@sobolevn ok, but why? We already have import _setup on 34 line
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.
In general, the default position is the status quo, you need to justify every change.
donbarbosFeb 7, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
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 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>
AA-Turner left a comment • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
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 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