Skip to content

Commit

Permalink
fix #1965 / win / users() / critical: Py_INCREF(Py_None) before setti…
Browse files Browse the repository at this point in the history
…ng None object in C

Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
  • Loading branch information
giampaolo committed Oct 5, 2021
1 parent 71e56f7 commit a02ebde
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ XXXX-XX-XX
by Xuehai Pan)
- 1953_: [Windows] disk_partitions() crashes due to insufficient buffer len.
(patch by MaWe2019)
- 1965_: [Windows] fix "Fatal Python error: deallocating None" when calling
psutil.users() multiple times.
- 1991_: process_iter() can raise TypeError if invoked from multiple threads
(not thread-safe).

Expand Down
1 change: 1 addition & 0 deletions psutil/_psutil_windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -1252,6 +1252,7 @@ psutil_users(PyObject *self, PyObject *args) {
goto error;
}
else {
Py_INCREF(Py_None);
py_address = Py_None;
}

Expand Down

0 comments on commit a02ebde

Please sign in to comment.