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
Choice uses casefold() for case-insensitive conversion, but shell_complete() lowercases the incomplete value and compares it with lower(). This makes completion fail for Unicode case-folding expansions.
For example, Choice(["ẞ"], case_sensitive=False) accepts "ß" during conversion because both values case-fold to "ss", but completion for the incomplete value "ß" returns no suggestion because "ss".lower().startswith("ß") is false.
Steps to reproduce
fromclickimportChoicechoice=Choice(["ẞ"], case_sensitive=False)
assertchoice.convert("ß", None, None) =="ẞ"# A completion callback using this Choice receives incomplete="ß".# It currently produces no completion item, even though the normalized choice is "ss".
The relevant implementation is Choice.shell_complete() in src/click/types.py; it uses lower() while normalize_choice() uses casefold().
Expected behavior
Case-insensitive shell completion should use the same Unicode-aware normalization as conversion and return the normalized "ss" suggestion for incomplete "ß".
Actual behavior
No completion item is returned.
Environment
Latest main at the time of filing
Python 3.12+
Click shell completion
I searched existing issues and pull requests for Unicode casefolding and Choice completion and did not find a matching report. A regression test covering ẞ/ß would prevent this from recurring.
changes: use Unicode casefold() consistently in shell completion, add a ẞ/ß regression test, add a changelog entry and versionchanged note
verification: 59 passed in tests/test_shell_completion.py; compileall and git diff --check passed
GitHub rejected PR creation for this account with does not have the correct permissions to execute CreatePullRequest, apparently due Click's first-time-contributor controls. Could a maintainer approve this contribution or open the equivalent PR from the branch when possible?
Activity
januththedev commentedon Sep 24, 2026
I prepared and pushed a focused fix on
januththedev:fix/unicode-casefold-completion:fb499f6casefold()consistently in shell completion, add aẞ/ßregression test, add a changelog entry and versionchanged note59 passedintests/test_shell_completion.py; compileall andgit diff --checkpassedGitHub rejected PR creation for this account with
does not have the correct permissions to execute CreatePullRequest, apparently due Click's first-time-contributor controls. Could a maintainer approve this contribution or open the equivalent PR from the branch when possible?ThiefMaster commentedon Sep 24, 2026
Now why would you create this PR via the API and not via the GH web interface? Because you are using some AI agent by any chance?
Read our AI policy: https://palletsprojects.com/contributing/llm-ai
[-]Case-insensitive Choice completion misses Unicode case-folding matches[/-][+][rejected AI] Case-insensitive Choice completion misses Unicode case-folding matches[/+]