Skip to content

[psutil] Fix None return types of wait, ionice, rlimit, cpu_freq, net_io_counters - #16824

Open
hemtilva wants to merge 2 commits into
python:mainfrom
hemtilva:psutil-none-returns
Open

hemtilva wants to merge 2 commits into
python:mainfrom
hemtilva:psutil-none-returns

Conversation

@hemtilva

Copy link
Copy Markdown
Contributor

Fixes #16823

  • Process.wait() now returns int | None.
  • Process.ionice() and Process.rlimit() get overloads: getting returns pionice / tuple[int, int], setting returns None.
  • cpu_freq() and net_io_counters() (non-per-item overloads) now return ... | None, the same as disk_io_counters() already does.
  • New @tests/test_cases/check_optional_returns.py covers each change.

Checked against the psutil 7.2.2 source, and on Linux (WSL) for wait, ionice and rlimit. mypy on stubs/psutil is clean, and regr_test.py psutil passes for linux and win32. The test file gives 5 errors on linux with the old stubs. I couldn't run stubtest locally (it fails to start on Windows), so I'm relying on CI for that.

I used Claude to help find these and write the change.

Copilot AI balanced review requested due to automatic review settings November 16, 2026 05:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[psutil] wait, ionice, rlimit, cpu_freq and net_io_counters can return None

2 participants