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

Fix incorrect passing of flags to re.sub #2581

Merged
merged 2 commits into from Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.rst
Expand Up @@ -5,6 +5,8 @@ Version 8.1.7

Unreleased

- Fix issue with regex flags in shell completion. :issue:`2581`


Version 8.1.6
-------------
Expand Down
2 changes: 1 addition & 1 deletion src/click/_compat.py
Expand Up @@ -516,7 +516,7 @@ def _get_argv_encoding() -> str:

_ansi_stream_wrappers: t.MutableMapping[t.TextIO, t.TextIO] = WeakKeyDictionary()

def auto_wrap_for_ansi(
def auto_wrap_for_ansi( # noqa: F811
stream: t.TextIO, color: t.Optional[bool] = None
) -> t.TextIO:
"""Support ANSI color and style codes on Windows by wrapping a
Expand Down
2 changes: 1 addition & 1 deletion src/click/shell_completion.py
Expand Up @@ -230,7 +230,7 @@ def func_name(self) -> str:
"""The name of the shell function defined by the completion
script.
"""
safe_name = re.sub(r"\W*", "", self.prog_name.replace("-", "_"), re.ASCII)
safe_name = re.sub(r"\W*", "", self.prog_name.replace("-", "_"), flags=re.ASCII)
return f"_{safe_name}_completion"

def source_vars(self) -> t.Dict[str, t.Any]:
Expand Down