Fix process pool fallback on Python 3.10 (GH-2631)
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>
This commit is contained in:
parent
9a73bb86db
commit
05954c0950
@ -1,5 +1,11 @@
|
|||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
### _Black_
|
||||||
|
|
||||||
|
- Fixed Python 3.10 support on platforms without ProcessPoolExecutor (#2631)
|
||||||
|
|
||||||
## 21.11b1
|
## 21.11b1
|
||||||
|
|
||||||
### _Black_
|
### _Black_
|
||||||
|
@ -687,7 +687,7 @@ def reformat_many(
|
|||||||
worker_count = min(worker_count, 60)
|
worker_count = min(worker_count, 60)
|
||||||
try:
|
try:
|
||||||
executor = ProcessPoolExecutor(max_workers=worker_count)
|
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
|
# 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
|
# 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
|
# a ThreadPoolExecutor with just a single worker (more workers would not do us
|
||||||
|
Loading…
Reference in New Issue
Block a user