Skip to content

Commit

Permalink
Always call freeze_support() if sys.frozen is True
Browse files Browse the repository at this point in the history
This shouldn't be necessary, but in practice macOS also requires
freeze_support() so let's play it safe and always call it when
sys.frozen is truthy. Only a tiny sliver of users will be using these
PyInstaller executables and the start-up performance is already terrible
as the executable unzips itself on the fly anyway.
  • Loading branch information
ichard26 committed Sep 17, 2022
1 parent d852af7 commit 7598cea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGES.md
Expand Up @@ -25,6 +25,10 @@

<!-- Changes to how Black is packaged, such as dependency requirements -->

- Executables made with PyInstaller will no longer crash when formatting several files
at once on macOS. Native x86-64 executables for macOS will be available once again.
(#3275)

### Parser

<!-- Changes to the parser or to version autodetection -->
Expand Down
2 changes: 1 addition & 1 deletion src/black/__init__.py
Expand Up @@ -1375,7 +1375,7 @@ def patch_click() -> None:


def patched_main() -> None:
if sys.platform == "win32" and getattr(sys, "frozen", False):
if getattr(sys, "frozen", False):
from multiprocessing import freeze_support

freeze_support()
Expand Down

0 comments on commit 7598cea

Please sign in to comment.