Click 8.0 renamed its "die on LANG=C" function so we need to look for that one too (#2227)

This commit is contained in:
Łukasz Langa 2021-05-12 21:47:32 +02:00 committed by GitHub
parent 94a0b07dbe
commit b2ee211b5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 4 deletions

View File

@ -1,5 +1,11 @@
# Change Log # Change Log
## Unreleased
### _Black_
- Restored compatibility with Click 8.0 on Python 3.6 when LANG=C used (#2227)
## 21.5b1 ## 21.5b1
### _Black_ ### _Black_

View File

@ -33,5 +33,7 @@ cache_dir=/dev/null
[mypy-aiohttp.*] [mypy-aiohttp.*]
follow_imports=skip follow_imports=skip
[mypy-_version] [mypy-black]
follow_imports=skip # The following is because of `patch_click()`. Remove when
# we drop Python 3.6 support.
warn_unused_ignores=False

View File

@ -1029,7 +1029,7 @@ def nullcontext() -> Iterator[None]:
def patch_click() -> 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 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 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): for module in (core, _unicodefun):
if hasattr(module, "_verify_python3_env"): 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: def patched_main() -> None: