diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2015-02-12 10:53:45 -0800 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2015-02-12 10:53:45 -0800 |
commit | bfdd3543bd31d58febe9973b9d12847de2e25311 (patch) | |
tree | eab0dde35b92030dd8be54898d386c65669004a1 | |
parent | 7e1493c139c61abcddf4de3823bc2199f1d539f4 (diff) | |
download | psutil-bfdd3543bd31d58febe9973b9d12847de2e25311.tar.gz |
make.bat: use build_ext -i; also fix a test
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | make.bat | 5 | ||||
-rw-r--r-- | psutil/_pswindows.py | 8 |
3 files changed, 12 insertions, 3 deletions
@@ -27,7 +27,7 @@ build: clean $(PYTHON) setup.py build @# copies *.so files in ./psutil directory in order to allow @# "import psutil" when using the interactive interpreter from within - @# this directory . + @# this directory. $(PYTHON) setup.py build_ext -i install: build @@ -70,6 +70,11 @@ if "%1" == "build" ( :build %PYTHON% setup.py build if %errorlevel% neq 0 goto :error + rem copies *.pyd files in ./psutil directory in order to allow + rem "import psutil" when using the interactive interpreter from + rem within this directory. + %PYTHON% setup.py build_ext -i + if %errorlevel% neq 0 goto :error goto :eof ) diff --git a/psutil/_pswindows.py b/psutil/_pswindows.py index 1eb10caa..52443cf5 100644 --- a/psutil/_pswindows.py +++ b/psutil/_pswindows.py @@ -16,7 +16,7 @@ from . import _common from . import _psutil_windows as cext from ._common import conn_tmap, usage_percent, isfile_strict from ._common import sockfam_to_enum, socktype_to_enum -from ._compat import PY3, xrange, lru_cache +from ._compat import PY3, xrange, lru_cache, long from ._psutil_windows import (ABOVE_NORMAL_PRIORITY_CLASS, BELOW_NORMAL_PRIORITY_CLASS, HIGH_PRIORITY_CLASS, @@ -496,7 +496,11 @@ class Process(object): allcpus = list(range(len(per_cpu_times()))) for cpu in value: if cpu not in allcpus: - raise ValueError("invalid CPU %r" % cpu) + if not isinstance(cpu, (int, long)): + raise TypeError( + "invalid CPU %r; an integer is required" % cpu) + else: + raise ValueError("invalid CPU %r" % cpu) bitmask = to_bitmask(value) cext.proc_cpu_affinity_set(self.pid, bitmask) |