You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
zsh completion setup fails with 'parse error near elif' #3277
I was able to reproduce the issue (on mac) by rewriting the shell completion script to use CRLF line endings. With those line endings, zsh fails to parse a fi\r and when it reaches elif you get the parse error.
tuple-param-zsh-complete-crlf.zsh:18: parse error near elif'`
This occurs because inside _compat.py, it uses Python’s TextIOWrapper, which translates each written \n to the platform's line separator. So even though the stream contains only \n it gets converted to \r\n on windows.
I believe the fix in #3279 correctly addresses this issue. The PR avoids emitting text-mode (which turns \n into \r\n) and instead emits output as bytes so there's no newline translation. This should keep the generated zsh script LF-only.
Activity
azanali-10xe commentedon Mar 27, 2026
I have been looking into this, @davidism can you let me know why the linked PR was closed?
davidism commentedon Mar 27, 2026
LLM generated
falkben commentedon May 18, 2026
I was able to reproduce the issue (on mac) by rewriting the shell completion script to use CRLF line endings. With those line endings, zsh fails to parse a
fi\rand when it reacheselifyou get the parse error.tuple-param-zsh-complete-crlf.zsh:18: parse error nearelif'`This occurs because inside _compat.py, it uses Python’s
TextIOWrapper, which translates each written\nto the platform's line separator. So even though the stream contains only\nit gets converted to\r\non windows.I believe the fix in #3279 correctly addresses this issue. The PR avoids emitting text-mode (which turns
\ninto\r\n) and instead emits output as bytes so there's no newline translation. This should keep the generated zsh script LF-only.Implement Unix line endings for shell completion output to ensure com…
Implement Unix line endings for shell completion output to ensure com…
Implement Unix line endings for shell completion output to ensure com…