gh-109649: Add affinity parameter to os.cpu_count() by vstinner · Pull Request #109652 · python/cpython

aisk

corona10

@vstinner vstinner changed the title gh-109649: Add usable parameter to os.cpu_count() gh-109649: Add affinity parameter to os.cpu_count()

Sep 21, 2023

gpshead

gpshead

@vstinner

Implement cpu_count(affinity=True) with sched_getaffinity().

Changes:

* Fix test_posix.test_sched_getaffinity(): restore the old CPU mask
  when the test completes!
* Doc: Specify that os.cpu_count() counts *logicial* CPUs. Mention
  that Linux cgroups are ignored.

@vstinner vstinner marked this pull request as ready for review

September 21, 2023 23:56