merge 70783 back to 26maint

This commit is contained in:
Jesse Noller 2009-03-30 23:38:36 +00:00
parent d5ac4447ba
commit f0d21c751b
4 changed files with 9 additions and 1 deletions

View file

@ -548,6 +548,10 @@ class _TestLock(BaseTestCase):
self.assertEqual(lock.release(), None) self.assertEqual(lock.release(), None)
self.assertRaises((AssertionError, RuntimeError), lock.release) self.assertRaises((AssertionError, RuntimeError), lock.release)
def test_lock_context(self):
with self.Lock():
pass
class _TestSemaphore(BaseTestCase): class _TestSemaphore(BaseTestCase):

View file

@ -251,6 +251,7 @@ Dinu Gherman
Jonathan Giddy Jonathan Giddy
Johannes Gijsbers Johannes Gijsbers
Michael Gilfix Michael Gilfix
Tim Golden
Chris Gonnerman Chris Gonnerman
David Goodger David Goodger
Hans de Graaff Hans de Graaff

View file

@ -92,6 +92,9 @@ Core and Builtins
Library Library
------- -------
- Issue #5261: Patch multiprocessing's semaphore.c to support context
manager use: "with multiprocessing.Lock()" works now.
- Issue #5177: Multiprocessing's SocketListener class now uses - Issue #5177: Multiprocessing's SocketListener class now uses
socket.SO_REUSEADDR on all connections so that the user no longer needs socket.SO_REUSEADDR on all connections so that the user no longer needs
to wait 120 seconds for the socket to expire. to wait 120 seconds for the socket to expire.

View file

@ -546,7 +546,7 @@ static PyMethodDef semlock_methods[] = {
"acquire the semaphore/lock"}, "acquire the semaphore/lock"},
{"release", (PyCFunction)semlock_release, METH_NOARGS, {"release", (PyCFunction)semlock_release, METH_NOARGS,
"release the semaphore/lock"}, "release the semaphore/lock"},
{"__enter__", (PyCFunction)semlock_acquire, METH_VARARGS, {"__enter__", (PyCFunction)semlock_acquire, METH_VARARGS | METH_KEYWORDS,
"enter the semaphore/lock"}, "enter the semaphore/lock"},
{"__exit__", (PyCFunction)semlock_release, METH_VARARGS, {"__exit__", (PyCFunction)semlock_release, METH_VARARGS,
"exit the semaphore/lock"}, "exit the semaphore/lock"},