Skip to content

Commit

Permalink
Add os.process_cpu_count() for 3.13 (#12905)
Browse files Browse the repository at this point in the history
  • Loading branch information
tamird authored Oct 25, 2024
1 parent b954cd7 commit fc8bff1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions stdlib/os/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,14 @@ if sys.platform != "win32":

def cpu_count() -> int | None: ...

if sys.version_info >= (3, 13):
# Documented to return `int | None`, but falls back to `len(sched_getaffinity(0))` when
# available. See https://github.com/python/cpython/blob/417c130/Lib/os.py#L1175-L1186.
if sys.platform != "win32" and sys.platform != "darwin":
def process_cpu_count() -> int: ...
else:
def process_cpu_count() -> int | None: ...

if sys.platform != "win32":
# Unix only
def confstr(name: str | int, /) -> str | None: ...
Expand Down

0 comments on commit fc8bff1

Please sign in to comment.