Skip to content
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

REPL not respecting sys.ps1 sys.ps2 if set in HYSTARTUP #2546

Closed
atisharma opened this issue Jan 16, 2024 · 1 comment · Fixed by #2547
Closed

REPL not respecting sys.ps1 sys.ps2 if set in HYSTARTUP #2546

atisharma opened this issue Jan 16, 2024 · 1 comment · Fixed by #2547

Comments

@atisharma
Copy link

The documentation for the REPL gives an example of setting the REPL prompt. Here is the simplest hyrc to illustrate the problem.

(import sys)
(setv sys.ps1 "* ")
(print f"sys.ps1 overridden to {sys.ps1}.")

Starting hy from bash (with HYSTARTUP set appropriately) does not replace sys.ps1. Setting sys.ps1 subsequently gives the expected behaviour.

> hy
sys.ps1 overridden to * .
Hy 0.28.0 using CPython(main) 3.11.7 on Linux
=> sys.ps1
"=> "
=>  (setv sys.ps1 "* ")
* 
@atisharma atisharma changed the title REPL not respecting sys.ps1, sys.ps2 hyrc/REPL not respecting sys.ps1, sys.ps2 Jan 16, 2024
@atisharma atisharma changed the title hyrc/REPL not respecting sys.ps1, sys.ps2 REPL not respecting sys.ps1, sys.ps2 if set in hyrc Jan 16, 2024
@Kodiologist
Copy link
Member

I think this used to work, but then I broke it as part of how I implemented restoration of the old sys.ps1 and sys.ps2 when quitting from a Hy REPL launched inside the Python REPL (#2355). Probably the right thing to do is have the user set different variables, say repl-ps1 and repl-ps2. The way the old setup worked, if you customized Hy's prompts, Python's would change to the same values, and vice versa.

@Kodiologist Kodiologist changed the title REPL not respecting sys.ps1, sys.ps2 if set in hyrc REPL not respecting sys.ps1 sys.ps2 if set in HYSTARTUP Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants