diff --git a/Doc/library/os.rst b/Doc/library/os.rst index 44732a750eb826..15e5f5c951db51 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -5197,7 +5197,7 @@ Miscellaneous System Information .. versionchanged:: 3.13 If :option:`-X cpu_count <-X>` is given or :envvar:`PYTHON_CPU_COUNT` is set, - :func:`cpu_count` returns the overrided value *n*. + :func:`cpu_count` returns the overridden value *n*. .. function:: getloadavg() @@ -5219,7 +5219,7 @@ Miscellaneous System Information in the **system**. If :option:`-X cpu_count <-X>` is given or :envvar:`PYTHON_CPU_COUNT` is set, - :func:`process_cpu_count` returns the overrided value *n*. + :func:`process_cpu_count` returns the overridden value *n*. See also the :func:`sched_getaffinity` functions. diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst index 64422fc11a3a3a..eb347e82ada4cf 100644 --- a/Doc/whatsnew/3.13.rst +++ b/Doc/whatsnew/3.13.rst @@ -170,7 +170,7 @@ os usable by the calling thread of the current process. (Contributed by Victor Stinner in :gh:`109649`.) -* :func:`os.cpu_count` and :func:`os.process_cpu_count` can be overrided through +* :func:`os.cpu_count` and :func:`os.process_cpu_count` can be overridden through the new environment variable :envvar:`PYTHON_CPU_COUNT` 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 without having to modify the container (application code). diff --git a/Lib/os.py b/Lib/os.py index de43e97745695a..6f7f97d3b18224 100644 --- a/Lib/os.py +++ b/Lib/os.py @@ -1139,7 +1139,7 @@ def add_dll_directory(path): ) -if _exists('sched_getaffinity') and _get_cpu_count_config() != 'overrided': +if _exists('sched_getaffinity') and _get_cpu_count_config() != 'overridden': def process_cpu_count(): """ Get the number of CPUs of the current process. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 94d7a37984caf0..9ad04f27d5ca5a 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -14347,7 +14347,7 @@ os__get_cpu_count_config_impl(PyObject *module) { const PyConfig *config = _Py_GetConfig(); if (config->cpu_count > 0) { - return PyUnicode_FromString("overrided"); + return PyUnicode_FromString("overridden"); } return PyUnicode_FromString("default"); }