From 74c80a78a6c8b7c5a6a7cd3ae0b4d788669b3d28 Mon Sep 17 00:00:00 2001 From: Ivan Levkivskyi Date: Tue, 6 Oct 2026 17:35:11 +0100 Subject: [PATCH] Fix psutil.cpu_affinity() not available on NetBSD --- mypy/util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mypy/util.py b/mypy/util.py index 5ad45af77e329..d6a8b1eccef3b 100644 --- a/mypy/util.py +++ b/mypy/util.py @@ -1009,8 +1009,8 @@ 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 sys.platform != "darwin": - # Currently not supported on macOS. + if PSUTIL_AVAILABLE and (psutil.LINUX or psutil.WINDOWS or psutil.FREEBSD): + # Currently not supported on macOS and NetBSD. affinity = psutil.Process().cpu_affinity() assert cpu_count is not None