Skip to content

Commit 0f160f8

Browse files
committed
Fix 3.10
1 parent 8449bb5 commit 0f160f8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

mypy/build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ def parse_all(self, states: Iterable[State]) -> None:
961961
# TODO: we should probably use psutil instead.
962962
# With psutil we can get a number of physical cores, while all stdlib
963963
# functions include virtual cores (which is not optimal for performance).
964-
available_threads = len(os.sched_getaffinity(0))
964+
available_threads = os.cpu_count() or 2 # conservative fallback
965965
# For some reason there is no visible improvement with more than 8 threads.
966966
# TODO: consider writing our own ThreadPool as an optimization.
967967
with ThreadPoolExecutor(max_workers=min(available_threads, 8)) as executor:

0 commit comments

Comments
 (0)