From ddd4af3186762bd129e75323c7d53320c757fa54 Mon Sep 17 00:00:00 2001 From: Rishi <29522253+inuik@users.noreply.github.com> Date: Thu, 13 Oct 2022 23:09:13 -0400 Subject: [PATCH] Fixed multiprocessing issue on win64 with more than 60 cores (#172) --- autoflake.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/autoflake.py b/autoflake.py index 9fdcc63..74f4e3b 100755 --- a/autoflake.py +++ b/autoflake.py @@ -1453,7 +1453,11 @@ def _main(argv, standard_out, standard_error, standard_input=None) -> int: args["exclude"] = set() if args["jobs"] < 1: - args["jobs"] = os.cpu_count() or 1 + worker_count = os.cpu_count() + if sys.platform == "win32": + # Work around https://bugs.python.org/issue26903 + worker_count = min(worker_count, 60) + args["jobs"] = worker_count or 1 filenames = list(set(args["files"]))