diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2020-01-07 16:16:06 +0100 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2020-01-07 16:16:06 +0100 |
commit | 306ca7b6f8387f7c8f0e9dec176e795ab0d3f5fc (patch) | |
tree | bd890ae47556c486084406d413b11bb678b02240 | |
parent | 57356c43cae11322f9ef7d1e882e3c9954736b7b (diff) | |
download | psutil-306ca7b6f8387f7c8f0e9dec176e795ab0d3f5fc.tar.gz |
#1652: ionice(), remove code checking if we're on Win Vista+
-rw-r--r-- | psutil/_pswindows.py | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/psutil/_pswindows.py b/psutil/_pswindows.py index f5c81c6d..3e14bc3c 100644 --- a/psutil/_pswindows.py +++ b/psutil/_pswindows.py @@ -79,7 +79,6 @@ __extra__all__ = [ # ===================================================================== CONN_DELETE_TCB = "DELETE_TCB" -HAS_PROC_IO_PRIORITY = hasattr(cext, "proc_io_priority_get") ERROR_PARTIAL_COPY = 299 @@ -1006,23 +1005,21 @@ class Process(object): def nice_set(self, value): return cext.proc_priority_set(self.pid, value) - # available on Windows >= Vista - if HAS_PROC_IO_PRIORITY: - @wrap_exceptions - def ionice_get(self): - ret = cext.proc_io_priority_get(self.pid) - if enum is not None: - ret = IOPriority(ret) - return ret + @wrap_exceptions + def ionice_get(self): + ret = cext.proc_io_priority_get(self.pid) + if enum is not None: + ret = IOPriority(ret) + return ret - @wrap_exceptions - def ionice_set(self, ioclass, value): - if value: - raise TypeError("value argument not accepted on Windows") - if ioclass not in (IOPRIO_VERYLOW, IOPRIO_LOW, IOPRIO_NORMAL, - IOPRIO_HIGH): - raise ValueError("%s is not a valid priority" % ioclass) - cext.proc_io_priority_set(self.pid, ioclass) + @wrap_exceptions + def ionice_set(self, ioclass, value): + if value: + raise TypeError("value argument not accepted on Windows") + if ioclass not in (IOPRIO_VERYLOW, IOPRIO_LOW, IOPRIO_NORMAL, + IOPRIO_HIGH): + raise ValueError("%s is not a valid priority" % ioclass) + cext.proc_io_priority_set(self.pid, ioclass) @wrap_exceptions def io_counters(self): |