From af3de081542f66dfb1482dcf2a654b7e1668783c Mon Sep 17 00:00:00 2001 From: Richard Si <63936253+ichard26@users.noreply.github.com> Date: Sun, 25 Sep 2022 20:55:52 -0400 Subject: [PATCH 1/1] Always call freeze_support() if sys.frozen is True (#3275) --- CHANGES.md | 3 +++ src/black/__init__.py | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index a775c76..6fb0990 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -31,6 +31,9 @@ +- Executables made with PyInstaller will no longer crash when formatting several files + at once on macOS. Native x86-64 executables for macOS are available once again. + (#3275) - Hatchling is now used as the build backend. This will not have any effect for users who install Black with its wheels from PyPI. (#3233) - Faster compiled wheels are now available for CPython 3.11 (#3276) diff --git a/src/black/__init__.py b/src/black/__init__.py index ded4a73..5b8c974 100644 --- a/src/black/__init__.py +++ b/src/black/__init__.py @@ -1375,7 +1375,9 @@ def patch_click() -> None: def patched_main() -> None: - if sys.platform == "win32" and getattr(sys, "frozen", False): + # PyInstaller patches multiprocessing to need freeze_support() even in non-Windows + # environments so just assume we always need to call it if frozen. + if getattr(sys, "frozen", False): from multiprocessing import freeze_support freeze_support() -- 2.39.5