Skip to content

Commit

Permalink
Fix process pool fallback on Python 3.10 (GH-2631)
Browse files Browse the repository at this point in the history
In Python 3.10 the exception generated by creating a process pool on
a Python build that doesn't support this is now `NotImplementedError`

Commit history before merge:

* Fix process pool fallback on Python 3.10
* Update CHANGES.md
* Update CHANGES.md

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
  • Loading branch information
MatthewScholefield and JelleZijlstra committed Nov 20, 2021
1 parent 9a73bb8 commit 05954c0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGES.md
@@ -1,5 +1,11 @@
# Change Log

## Unreleased

### _Black_

- Fixed Python 3.10 support on platforms without ProcessPoolExecutor (#2631)

## 21.11b1

### _Black_
Expand Down
2 changes: 1 addition & 1 deletion src/black/__init__.py
Expand Up @@ -687,7 +687,7 @@ def reformat_many(
worker_count = min(worker_count, 60)
try:
executor = ProcessPoolExecutor(max_workers=worker_count)
except (ImportError, OSError):
except (ImportError, NotImplementedError, OSError):
# we arrive here if the underlying system does not support multi-processing
# like in AWS Lambda or Termux, in which case we gracefully fallback to
# a ThreadPoolExecutor with just a single worker (more workers would not do us
Expand Down

0 comments on commit 05954c0

Please sign in to comment.