Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
corona10 committed Sep 30, 2023
1 parent 3ab2bc4 commit 7231697
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Doc/c-api/init_config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -881,12 +881,12 @@ PyConfig
.. c:member:: int cpu_count
If the value of <cpu_count> is not ``-1`` then it will override
the return value of :func:`cpu_count` into <cpu_count>.
the return value of :func:`cpu_count` and :func:`process_cpu_count` into <cpu_count>.
Configured by the :samp:`-X cpu_count={n}` command line
flag or the :envvar:`PYTHONCPUCOUNT` environment variable.
Default: ``-1``, it will follow the original behavior of :func:`cpu_count`.
Default: ``-1``, it will follow the original behavior of :func:`cpu_count` and :func:`process_cpu_count.
.. versionadded:: 3.13
Expand Down
3 changes: 3 additions & 0 deletions Doc/library/os.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5218,6 +5218,9 @@ Miscellaneous System Information
The :func:`cpu_count` function can be used to get the number of logical CPUs
in the **system**.

If :samp:`-X cpu_count={n}` is given or :envvar:`PYTHONCPUCOUNT` is set,
:func:`process_cpu_count` returns the overrided value *n*.

See also the :func:`sched_getaffinity` functions.

.. versionadded:: 3.13
Expand Down
4 changes: 2 additions & 2 deletions Doc/using/cmdline.rst
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ Miscellaneous options
report Python calls. This option is only available on some platforms and
will do nothing if is not supported on the current system. The default value
is "off". See also :envvar:`PYTHONPERFSUPPORT` and :ref:`perf_profiling`.
* :samp:`-X cpu_count={n}` overrides :func:`os.cpu_count`.
* :samp:`-X cpu_count={n}` overrides :func:`os.cpu_count` and :func:`os.process_cpu_count`.
*n* must be greater than or equal to 1.
This option is useful for users who need to limit CPU resources of a container system.
See also :envvar:`PYTHONCPUCOUNT`.
Expand Down Expand Up @@ -1076,7 +1076,7 @@ conflict.
.. envvar:: PYTHONCPUCOUNT

If this variable is set to a positive integer, it overrides
:func:`os.cpu_count`
:func:`os.cpu_count` and and :func:`os.process_cpu_count`.

See also the :samp:`-X cpu_count={n}` command-line option.

Expand Down
4 changes: 2 additions & 2 deletions Doc/whatsnew/3.13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ opcode
os
--

* :func:`os.cpu_count` can be overrided through the new
environment variable :envvar:`PYTHONCPUCOUNT` or the new command-line option
* :func:`os.cpu_count` and :func:`os.process_cpu_count` can be overrided through
the new environment variable :envvar:`PYTHONCPUCOUNT` or the new command-line option
:option:`-X cpu_count <-X>`. This option is useful for users who need to limit
CPU resources of a container system.(Contributed by Donghee Na in :gh:`109595`)

Expand Down

0 comments on commit 7231697

Please sign in to comment.