From 095b0037480de7acb054f7e3067b667eb21ee9dd Mon Sep 17 00:00:00 2001 From: "Matthew D. Scholefield" Date: Sat, 20 Nov 2021 03:55:10 -0800 Subject: [PATCH 1/3] Fix process pool fallback on Python 3.10 In Python 3.10 the exception generated by creating a process pool on a Python build that doesn't support this is now `NotImplementedError` --- src/black/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/black/__init__.py b/src/black/__init__.py index a5ddec91221..aa7970cfd6c 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 From 4e5fb5643e82ba3725d19ac0218c91d3d12e09f3 Mon Sep 17 00:00:00 2001 From: "Matthew D. Scholefield" Date: Sat, 20 Nov 2021 04:03:01 -0800 Subject: [PATCH 2/3] Update CHANGES.md --- CHANGES.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 35024de724d..8d00ed637ca 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,11 @@ # Change Log +## Unreleased + +### _Black_ + +- Fixed Python 3.10 support on platforms without ProcessPoolExecutor + ## 21.11b1 ### _Black_ From 0bfc53ecd82f38e6737df177940164c745c68517 Mon Sep 17 00:00:00 2001 From: "Matthew D. Scholefield" Date: Sat, 20 Nov 2021 04:26:58 -0800 Subject: [PATCH 3/3] Update CHANGES.md Co-authored-by: Jelle Zijlstra --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 8d00ed637ca..db519ac6bbc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,7 +4,7 @@ ### _Black_ -- Fixed Python 3.10 support on platforms without ProcessPoolExecutor +- Fixed Python 3.10 support on platforms without ProcessPoolExecutor (#2631) ## 21.11b1