You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add -Xcpu_count=process cmdline mode to redirect os.cpu_count as os.process_cpu_count #110649
Since we add the os. process_cpu_count from #109649 and -Xcpu_count= command from #109595, we can easily redirect os.cpu_count to os. process_cpu_count as we discussed at #109595 (comment)
Why not modifying code to replace os.cpu_count() with os.process_cpu_count()?
Support -X cpu_count=process: os.cpu_count() becomes an alias to os.process_cpu_count(). So legacy applications using os.cpu_count() for use case (A) (decide how many worker processes should be run) and run in read-only containers with Python 3.13 can be run with -X cpu_count=process to use the correct number of CPUs. Obviously, -X cpu_count=number would remain available if the sysadmin has a good knowledge of its system or if Python returns the wrong number of CPUs (especially in groups).
Well, I consider the case that if people want to replace it without modifying source code(3rd party library) from os.cpu_count() and os.process_cpu_count() by default.
Since we add the os. process_cpu_count from #109649 and -Xcpu_count= command from #109595, we can easily redirect os.cpu_count to os. process_cpu_count as we discussed at #109595 (comment)
Linked PRs