Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions mypy/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1009,8 +1009,13 @@ def get_available_threads() -> int:
# Not available on old Python versions on some platforms.
if sys.platform == "linux":
affinity = os.sched_getaffinity(0)
if PSUTIL_AVAILABLE and (psutil.LINUX or psutil.WINDOWS or psutil.FREEBSD):
# Currently not supported on macOS and NetBSD.
if (
PSUTIL_AVAILABLE
# This matches platform availability in psutil docs.
and (psutil.LINUX or psutil.WINDOWS or psutil.FREEBSD)
# This is redundant, but needed for self-check.
and sys.platform != "darwin"
):
affinity = psutil.Process().cpu_affinity()

assert cpu_count is not None
Expand Down
Loading