Skip to content

Commit

Permalink
add block parenthesys (damn!)
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Feb 25, 2019
1 parent f38a560 commit 2d30ca1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
6 changes: 2 additions & 4 deletions psutil/_psutil_windows.c
Expand Up @@ -1998,8 +1998,7 @@ psutil_proc_cpu_affinity_set(PyObject *self, PyObject *args) {


/*
* Return True if one of the process threads is in a waiting or
* suspended status.
* Return True if all process threads are in waiting/suspended state.
*/
static PyObject *
psutil_proc_is_suspended(PyObject *self, PyObject *args) {
Expand All @@ -2010,9 +2009,8 @@ psutil_proc_is_suspended(PyObject *self, PyObject *args) {

if (! PyArg_ParseTuple(args, "l", &pid))
return NULL;
if (! psutil_get_proc_info(pid, &process, &buffer)) {
if (! psutil_get_proc_info(pid, &process, &buffer))
return NULL;
}
for (i = 0; i < process->NumberOfThreads; i++) {
if (process->Threads[i].ThreadState != Waiting ||
process->Threads[i].WaitReason != Suspended)
Expand Down
12 changes: 8 additions & 4 deletions psutil/arch/windows/process_info.c
Expand Up @@ -222,17 +222,21 @@ psutil_is_phandle_running(HANDLE hProcess, DWORD pid) {
HANDLE
psutil_check_phandle(HANDLE hProcess, DWORD pid) {
int ret = psutil_is_phandle_running(hProcess, pid);
if (ret == 1)
if (ret == 1) {
return hProcess;
else if (ret == 0)
}
else if (ret == 0) {
return NoSuchProcess("");
else if (ret == -1)
}
else if (ret == -1) {
if (GetLastError() == ERROR_ACCESS_DENIED)
return PyErr_SetFromWindowsErr(0);
else
return PyErr_SetFromOSErrnoWithSyscall("OpenProcess");
else // -2
}
else {
return NULL;
}
}


Expand Down

0 comments on commit 2d30ca1

Please sign in to comment.