From: Matthew D. Scholefield Date: Sat, 20 Nov 2021 19:25:30 +0000 (-0800) Subject: Fix process pool fallback on Python 3.10 (GH-2631) X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/05954c0950637aa1039d0ac86a4a7e832cbffd9f?ds=sidebyside;hp=9a73bb86db59de1e12426fec81dcdb7f3bb9be7b 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 --- diff --git a/CHANGES.md b/CHANGES.md index 35024de..db519ac 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,11 @@ # Change Log +## Unreleased + +### _Black_ + +- Fixed Python 3.10 support on platforms without ProcessPoolExecutor (#2631) + ## 21.11b1 ### _Black_ diff --git a/src/black/__init__.py b/src/black/__init__.py index a5ddec9..aa7970c 100644 --- a/src/black/__init__.py +++ b/src/black/__init__.py @@ -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