diff options
author | Victor Stinner <vstinner@python.org> | 2023-10-01 01:14:57 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-01 01:14:57 (GMT) |
commit | a46e96076898d126c9f276aef1934195aac34b4e (patch) | |
tree | beaec25a75f381f77b74bf4e164eb813c20ec81f /Tools/wasm | |
parent | 53eb9a676f8c59b206dfc536b7590f6563ad65e0 (diff) | |
download | cpython-a46e96076898d126c9f276aef1934195aac34b4e.zip cpython-a46e96076898d126c9f276aef1934195aac34b4e.tar.gz cpython-a46e96076898d126c9f276aef1934195aac34b4e.tar.bz2 |
gh-109649: Use os.process_cpu_count() (#110165)
Replace os.cpu_count() with os.process_cpu_count() in modules:
* compileall
* concurrent.futures
* multiprocessing
Replace os.cpu_count() with os.process_cpu_count() in programs:
* _decimal deccheck.py test
* freeze.py
* multissltests.py
* python -m test (regrtest)
* wasm_build.py
Other changes:
* test.pythoninfo logs os.process_cpu_count().
* regrtest gets os.process_cpu_count() / os.cpu_count() in headers.
Diffstat (limited to 'Tools/wasm')
-rwxr-xr-x | Tools/wasm/wasm_build.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Tools/wasm/wasm_build.py b/Tools/wasm/wasm_build.py index 3558ecd..c0b9999 100755 --- a/Tools/wasm/wasm_build.py +++ b/Tools/wasm/wasm_build.py @@ -516,7 +516,11 @@ class BuildProfile: def getenv(self) -> Dict[str, Any]: """Generate environ dict for platform""" env = os.environ.copy() - env.setdefault("MAKEFLAGS", f"-j{os.cpu_count()}") + if hasattr(os, 'process_cpu_count'): + cpu_count = os.process_cpu_count() + else: + cpu_count = os.cpu_count() + env.setdefault("MAKEFLAGS", f"-j{cpu_count}") platenv = self.host.platform.getenv(self) for key, value in platenv.items(): if value is None: |