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

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

Merged
merged 1 commit into from May 12, 2021
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
6 changes: 6 additions & 0 deletions 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_
Expand Down
6 changes: 4 additions & 2 deletions mypy.ini
Expand Up @@ -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
6 changes: 4 additions & 2 deletions src/black/__init__.py
Expand Up @@ -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
Expand All @@ -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:
Expand Down