diff --git a/CHANGES.rst b/CHANGES.rst index 90faecc17..35a0ff428 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,6 +5,8 @@ Version 8.1.7 Unreleased +- Fix issue with regex flags in shell completion. :issue:`2581` + Version 8.1.6 ------------- diff --git a/src/click/shell_completion.py b/src/click/shell_completion.py index 5de124702..9091f787e 100644 --- a/src/click/shell_completion.py +++ b/src/click/shell_completion.py @@ -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]: