Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpu_count() should guard against return value < 1 and return None #1085

Closed
giampaolo opened this issue May 19, 2017 · 0 comments
Closed

cpu_count() should guard against return value < 1 and return None #1085

giampaolo opened this issue May 19, 2017 · 0 comments
Labels

Comments

@giampaolo
Copy link
Owner

#1078 made me think about this. Basically we make the promise that if the number of CPUs cannot be determined psutil.cpu_count() will return None. Anyway, we should guard against possible incorrect values returned by the kernel (e.g. -1 or 0) and also return None.

@giampaolo giampaolo added the bug label May 19, 2017
giampaolo added a commit that referenced this issue May 19, 2017
- no longer cache cpu_count() return value in Process.cpu_percent()
- in Process.cpu_percent(), guard against cpu_count() returning None and
  assume 1 instead
- add test cases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant