Skip to content

Commit

Permalink
Fix incorrect passing of flags to re.sub (#2581)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidism committed Aug 17, 2023
2 parents bb6a872 + d69d210 commit 22b9b1c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
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

0 comments on commit 22b9b1c

Please sign in to comment.