From: Ɓukasz Langa Date: Wed, 12 May 2021 19:47:32 +0000 (+0200) Subject: Click 8.0 renamed its "die on LANG=C" function so we need to look for that one too... X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/b2ee211b5ad84b62738ac0997b73bf6ee9a74d06?ds=inline Click 8.0 renamed its "die on LANG=C" function so we need to look for that one too (#2227) --- diff --git a/CHANGES.md b/CHANGES.md index 38eef52..becd621 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,11 @@ # Change Log +## Unreleased + +### _Black_ + +- Restored compatibility with Click 8.0 on Python 3.6 when LANG=C used (#2227) + ## 21.5b1 ### _Black_ diff --git a/mypy.ini b/mypy.ini index 589fbf6..ae7be5e 100644 --- a/mypy.ini +++ b/mypy.ini @@ -33,5 +33,7 @@ cache_dir=/dev/null [mypy-aiohttp.*] follow_imports=skip -[mypy-_version] -follow_imports=skip +[mypy-black] +# The following is because of `patch_click()`. Remove when +# we drop Python 3.6 support. +warn_unused_ignores=False diff --git a/src/black/__init__.py b/src/black/__init__.py index c61bc8c..f46b866 100644 --- a/src/black/__init__.py +++ b/src/black/__init__.py @@ -1029,7 +1029,7 @@ def nullcontext() -> Iterator[None]: def patch_click() -> None: - """Make Click not crash. + """Make Click not crash on Python 3.6 with LANG=C. On certain misconfigured environments, Python 3 selects the ASCII encoding as the default which restricts paths that it can access during the lifetime of the @@ -1047,7 +1047,9 @@ def patch_click() -> None: for module in (core, _unicodefun): if hasattr(module, "_verify_python3_env"): - module._verify_python3_env = lambda: None + module._verify_python3_env = lambda: None # type: ignore + if hasattr(module, "_verify_python_env"): + module._verify_python_env = lambda: None # type: ignore def patched_main() -> None: