[Python-checkins] cpython (merge default -> default): merge heads
senthil.kumaran
python-checkins at python.org
Wed Aug 3 12:47:26 CEST 2011
http://hg.python.org/cpython/rev/60353231df0c
changeset: 71733:60353231df0c
parent: 71732:a3981d0c4d9b
parent: 71728:597645db3cec
user: Senthil Kumaran <senthil at uthcode.com>
date: Wed Aug 03 18:45:02 2011 +0800
summary:
merge heads
files:
Lib/http/client.py | 4 ++--
Lib/test/test_posix.py | 17 +++++++++++++----
Lib/test/test_support.py | 2 ++
Modules/posixmodule.c | 2 +-
4 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/Lib/http/client.py b/Lib/http/client.py
--- a/Lib/http/client.py
+++ b/Lib/http/client.py
@@ -777,8 +777,8 @@
for d in data:
self.sock.sendall(d)
else:
- raise TypeError("data should be a bytes-like object\
- or an iterable, got %r " % type(data))
+ raise TypeError("data should be a bytes-like object "
+ "or an iterable, got %r" % type(data))
def _output(self, s):
"""Add a line of output to the current request buffer.
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -832,7 +832,7 @@
requires_sched_h = unittest.skipUnless(hasattr(posix, 'sched_yield'),
"don't have scheduling support")
requires_sched_affinity = unittest.skipUnless(hasattr(posix, 'cpu_set'),
- "dont' have sched affinity support")
+ "don't have sched affinity support")
@requires_sched_h
def test_sched_yield(self):
@@ -848,8 +848,10 @@
self.assertIsInstance(lo, int)
self.assertIsInstance(hi, int)
self.assertGreaterEqual(hi, lo)
- self.assertRaises(OSError, posix.sched_get_priority_min, -23)
- self.assertRaises(OSError, posix.sched_get_priority_max, -23)
+ # OSX evidently just returns 15 without checking the argument.
+ if sys.platform != "darwin":
+ self.assertRaises(OSError, posix.sched_get_priority_min, -23)
+ self.assertRaises(OSError, posix.sched_get_priority_max, -23)
@unittest.skipUnless(hasattr(posix, 'sched_setscheduler'), "can't change scheduler")
def test_get_and_set_scheduler_and_param(self):
@@ -888,7 +890,14 @@
@unittest.skipUnless(hasattr(posix, "sched_rr_get_interval"), "no function")
def test_sched_rr_get_interval(self):
- interval = posix.sched_rr_get_interval(0)
+ try:
+ interval = posix.sched_rr_get_interval(0)
+ except OSError as e:
+ # This likely means that sched_rr_get_interval is only valid for
+ # processes with the SCHED_RR scheduler in effect.
+ if e.errno != errno.EINVAL:
+ raise
+ self.skipTest("only works on SCHED_RR processes")
self.assertIsInstance(interval, float)
# Reasonable constraints, I think.
self.assertGreaterEqual(interval, 0.)
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -58,6 +58,7 @@
mod_filename = TESTFN + '.py'
with open(mod_filename, 'w') as f:
print('foo = 1', file=f)
+ sys.path.insert(0, os.curdir)
try:
mod = __import__(TESTFN)
self.assertIn(TESTFN, sys.modules)
@@ -65,6 +66,7 @@
support.forget(TESTFN)
self.assertNotIn(TESTFN, sys.modules)
finally:
+ del sys.path[0]
support.unlink(mod_filename)
def test_HOST(self):
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -4616,7 +4616,7 @@
sched_param_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
PyObject *res, *priority;
- static char *kwlist[] = {"sched_priority"};
+ static char *kwlist[] = {"sched_priority", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:sched_param", kwlist, &priority))
return NULL;
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list