Skip to content

Commit 6d35876

Browse files
authored
Fix psutil.cpu_affinity() not available on NetBSD (#22124)
Fixes #22103 I now match the logic identically to what is stated in `psutil` docs w.r.t. platform availability.
1 parent e576c20 commit 6d35876

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎mypy/util.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,8 +1009,8 @@ def get_available_threads() -> int:
10091009
# Not available on old Python versions on some platforms.
10101010
if sys.platform == "linux":
10111011
affinity = os.sched_getaffinity(0)
1012-
if PSUTIL_AVAILABLE and sys.platform != "darwin":
1013-
# Currently not supported on macOS.
1012+
if PSUTIL_AVAILABLE and (psutil.LINUX or psutil.WINDOWS or psutil.FREEBSD):
1013+
# Currently not supported on macOS and NetBSD.
10141014
affinity = psutil.Process().cpu_affinity()
10151015

10161016
assert cpu_count is not None

0 commit comments

Comments
 (0)