Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.4k
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 ourterms of service andprivacy 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
Lib/site.py Outdated
try: | ||
if os.getenv("PYTHON_BASIC_REPL"): | ||
if os.getenv("PYTHON_BASIC_REPL") or not _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 theexcept
block in__main__
when we have adumb
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.
@ambv: Do you have an idea on how to fix mypy? |
eugenetriguba commentedMay 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 |
In that case, |
Use CAN_USE_PYREPL of _pyrepl.__main__ in the site module to decideif _pyrepl.write_history_file() can be used.
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 decideif _pyrepl.write_history_file() can be used.(cherry picked from commit73f4a58)Co-authored-by: Victor Stinner <vstinner@python.org>
GH-119308 is a backport of this pull request to the3.13 branch. |
@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 |
Same behavior for me that@danielhollas described. |
Sorry, I didn't retest functionally after fixing mypy 😬 |
Please check my second fix: PRgh-119332. |
Use CAN_USE_PYREPL of _pyrepl.__main__ in the site module to decideif _pyrepl.write_history_file() can be used.
Uh oh!
There was an error while loading.Please reload this page.
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.