summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2015-02-12 10:53:45 -0800
committerGiampaolo Rodola <g.rodola@gmail.com>2015-02-12 10:53:45 -0800
commitbfdd3543bd31d58febe9973b9d12847de2e25311 (patch)
treeeab0dde35b92030dd8be54898d386c65669004a1
parent7e1493c139c61abcddf4de3823bc2199f1d539f4 (diff)
downloadpsutil-bfdd3543bd31d58febe9973b9d12847de2e25311.tar.gz
make.bat: use build_ext -i; also fix a test
-rw-r--r--Makefile2
-rw-r--r--make.bat5
-rw-r--r--psutil/_pswindows.py8
3 files changed, 12 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 71e2e207..f2ea0206 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/make.bat b/make.bat
index 4520a989..4c5bc83e 100644
--- a/make.bat
+++ b/make.bat
@@ -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)