Skip to content

gh-152686: Quote '!' in venv activate.csh for (t)csh#152687

Open
tonghuaroot wants to merge 1 commit into
python:mainfrom
tonghuaroot:fix-venv-csh-quote
Open

gh-152686: Quote '!' in venv activate.csh for (t)csh#152687
tonghuaroot wants to merge 1 commit into
python:mainfrom
tonghuaroot:fix-venv-csh-quote

Conversation

@tonghuaroot

@tonghuaroot tonghuaroot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

activate.csh substitutions were quoted with POSIX shlex.quote(), but
(t)csh history-expands ! even inside single quotes, so a venv created with
e.g. --prompt 'py!env' could not be activated under csh/tcsh.

Add quote_csh (escape !) and dispatch on the .csh suffix, matching the
existing quote_ps1/quote_bat handling from gh-124651, plus a regression
test (test_special_chars_csh_prompt).

Verified under csh and tcsh: !, ', $, backtick, ;, &&, spaces and
parens round-trip; bash/fish activation is unchanged. A newline in a csh
single-quoted string is unrepresentable and remains out of scope.

activate.csh substitutions were quoted with POSIX shlex.quote(), but (t)csh
history-expands '!' even inside single quotes, so a venv created with e.g.
--prompt 'py!env' could not be activated under csh/tcsh.

Add quote_csh (escape '!') and dispatch on the .csh suffix, matching the
existing quote_ps1/quote_bat handling from pythongh-124651, plus a regression test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant