Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-119102: Fix REPL for dumb terminal#119269
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
vstinner commented May 20, 2024 • 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.
vstinner commented May 20, 2024
Lib/site.py Outdated
| import_pyrepl | ||
| try: | ||
| ifos.getenv("PYTHON_BASIC_REPL"): | ||
| ifos.getenv("PYTHON_BASIC_REPL")ornot_pyrepl._CAN_USE_PYREPL: |
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.
question: This is working, I presume, because we're hitting the except block in __main__ when we have a dumb TERM setting? I was initially a bit confused because I wasn't seeing why an extra conditional on a setting for a win32 check would fix this
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.
_pyrepl._CAN_USE_PYREPL is set to False if pyrepl fails at startup.
vstinner commented May 21, 2024
@ambv: Do you have an idea on how to fix mypy? |
eugenetriguba commented May 21, 2024 • 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.
@vstinner |
vstinner commented May 21, 2024
In that case, |
Use CAN_USE_PYREPL of _pyrepl.__main__ in the site module to decide if _pyrepl.write_history_file() can be used.
vstinner commented May 21, 2024
I rewrote the fix to please the typing gods. |
Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
Use CAN_USE_PYREPL of _pyrepl.__main__ in the site module to decide if _pyrepl.write_history_file() can be used. (cherry picked from commit 73f4a58) Co-authored-by: Victor Stinner <vstinner@python.org>
GH-119308 is a backport of this pull request to the 3.13 branch. |
danielhollas commented May 21, 2024
@vstinner the new version doesn't seem to fix the issue for me (tested on Fedora 39). I've ran into the same problem when I was trying to fix this. It looks like |
lysnikolaou commented May 21, 2024
Same behavior for me that @danielhollas described. |
vstinner commented May 21, 2024
Sorry, I didn't retest functionally after fixing mypy 😬 |
vstinner commented May 21, 2024
Please check my second fix: PR gh-119332. |
Use CAN_USE_PYREPL of _pyrepl.__main__ in the site module to decide if _pyrepl.write_history_file() can be used.
Move CAN_USE_PYREPL variable from _pyrepl.main to _pyrepl and rename it to _CAN_USE_PYREPL. Use the variable in the site module to decide if _pyrepl.write_history_file() can be used.