diff options
| author | Giampaolo Rodola <g.rodola@gmail.com> | 2018-10-16 22:18:33 +0200 |
|---|---|---|
| committer | Giampaolo Rodola <g.rodola@gmail.com> | 2018-10-16 22:18:33 +0200 |
| commit | 6db8d2e41dc67621eae9d8eeab3c39fef7e2ddf4 (patch) | |
| tree | db98aaae072a2b73a5c2d4ac76858d8346beaefc /psutil/_pswindows.py | |
| parent | 8b465260638cde5370808e23eb9ace608141393a (diff) | |
| download | psutil-6db8d2e41dc67621eae9d8eeab3c39fef7e2ddf4.tar.gz | |
refactor hasattr() checks as global constants
Diffstat (limited to 'psutil/_pswindows.py')
| -rw-r--r-- | psutil/_pswindows.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/psutil/_pswindows.py b/psutil/_pswindows.py index 18651d6c..b938d42f 100644 --- a/psutil/_pswindows.py +++ b/psutil/_pswindows.py @@ -83,6 +83,7 @@ ACCESS_DENIED_ERRSET = frozenset([errno.EPERM, errno.EACCES, cext.ERROR_ACCESS_DENIED]) NO_SUCH_SERVICE_ERRSET = frozenset([cext.ERROR_INVALID_NAME, cext.ERROR_SERVICE_DOES_NOT_EXIST]) +HAS_PROC_IO_PRIORITY = hasattr(cext, "proc_io_priority_get") if enum is None: @@ -928,7 +929,7 @@ class Process(object): return cext.proc_priority_set(self.pid, value) # available on Windows >= Vista - if hasattr(cext, "proc_io_priority_get"): + if HAS_PROC_IO_PRIORITY: @wrap_exceptions def ionice_get(self): return cext.proc_io_priority_get(self.pid) |
