From 4e36d5ae883ef2718a8599ad1313679f4e7483c1 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Tue, 2 Aug 2011 19:56:11 -0500 Subject: need NULL sentinel --- Modules/posixmodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index f4461c0..572b5d1 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -4616,7 +4616,7 @@ static PyObject * 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; -- cgit v0.12 From 2b6ee286309bde403c9493e2c75d35c4f5b5abcb Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Wed, 3 Aug 2011 05:18:33 +0300 Subject: Issue #11049: fix test_forget on installed Python - add os.curdir to sys.path --- Lib/test/test_support.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py index 589f482..394e210 100644 --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@ -58,6 +58,7 @@ class TestSupport(unittest.TestCase): 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 @@ class TestSupport(unittest.TestCase): support.forget(TESTFN) self.assertNotIn(TESTFN, sys.modules) finally: + del sys.path[0] support.unlink(mod_filename) def test_HOST(self): -- cgit v0.12 From 539b6c41ffe5962af72ab394d87ded296ce0d19a Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Tue, 2 Aug 2011 22:09:37 -0500 Subject: OSX doesn't check sched_get_priority_(min/max) argument --- Lib/test/test_posix.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index 3fe791b..e43379e 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -848,8 +848,10 @@ class PosixTester(unittest.TestCase): 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): -- cgit v0.12 From c15815808678ac4f9d8bb48428bf98e51e155354 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Tue, 2 Aug 2011 22:10:55 -0500 Subject: fix indentation --- Lib/test/test_posix.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index e43379e..3793e09 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -850,8 +850,8 @@ class PosixTester(unittest.TestCase): self.assertGreaterEqual(hi, lo) # 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) + 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): -- cgit v0.12 From 50ba271dbbaf21a4eba461d84d005bbf52b5eb20 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Tue, 2 Aug 2011 22:15:40 -0500 Subject: fix punctuation --- Lib/test/test_posix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index 3793e09..e370532 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -832,7 +832,7 @@ class PosixTester(unittest.TestCase): 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): -- cgit v0.12 From 43234ab685996fc2d1ded4863986a797c1453853 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Tue, 2 Aug 2011 22:19:14 -0500 Subject: handle sched_rr_get_interval not working on current --- Lib/test/test_posix.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index e370532..af64a6f 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -890,7 +890,14 @@ class PosixTester(unittest.TestCase): @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.) -- cgit v0.12 From 25e2cd13885207d41344313984322b608a26fbac Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Wed, 3 Aug 2011 08:27:00 +0200 Subject: Fix spacing in string literal. --- Lib/http/client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/http/client.py b/Lib/http/client.py index 4906007..3f02729 100644 --- a/Lib/http/client.py +++ b/Lib/http/client.py @@ -777,8 +777,8 @@ class HTTPConnection: 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. -- cgit v0.12