[Python-checkins] r70783 - in python/trunk: Lib/test/test_multiprocessing.py Misc/ACKS Misc/NEWS Modules/_multiprocessing/semaphore.c
jesse.noller
python-checkins at python.org
Tue Mar 31 01:29:31 CEST 2009
Author: jesse.noller
Date: Tue Mar 31 01:29:31 2009
New Revision: 70783
Log:
merge in patch from tim golden to fix contextmanager support for mp.Lock()
Modified:
python/trunk/Lib/test/test_multiprocessing.py
python/trunk/Misc/ACKS
python/trunk/Misc/NEWS
python/trunk/Modules/_multiprocessing/semaphore.c
Modified: python/trunk/Lib/test/test_multiprocessing.py
==============================================================================
--- python/trunk/Lib/test/test_multiprocessing.py (original)
+++ python/trunk/Lib/test/test_multiprocessing.py Tue Mar 31 01:29:31 2009
@@ -546,6 +546,10 @@
self.assertEqual(lock.release(), None)
self.assertRaises((AssertionError, RuntimeError), lock.release)
+ def test_lock_context(self):
+ with self.Lock():
+ pass
+
class _TestSemaphore(BaseTestCase):
Modified: python/trunk/Misc/ACKS
==============================================================================
--- python/trunk/Misc/ACKS (original)
+++ python/trunk/Misc/ACKS Tue Mar 31 01:29:31 2009
@@ -256,6 +256,7 @@
Jonathan Giddy
Johannes Gijsbers
Michael Gilfix
+Tim Golden
Chris Gonnerman
David Goodger
Hans de Graaff
@@ -789,4 +790,3 @@
Uwe Zessin
Tarek Ziad
Peter Åstrand
-Jesse Noller
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS (original)
+++ python/trunk/Misc/NEWS Tue Mar 31 01:29:31 2009
@@ -199,6 +199,9 @@
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
socket.SO_REUSEADDR on all connections so that the user no longer needs
to wait 120 seconds for the socket to expire.
Modified: python/trunk/Modules/_multiprocessing/semaphore.c
==============================================================================
--- python/trunk/Modules/_multiprocessing/semaphore.c (original)
+++ python/trunk/Modules/_multiprocessing/semaphore.c Tue Mar 31 01:29:31 2009
@@ -546,7 +546,7 @@
"acquire the semaphore/lock"},
{"release", (PyCFunction)semlock_release, METH_NOARGS,
"release the semaphore/lock"},
- {"__enter__", (PyCFunction)semlock_acquire, METH_VARARGS,
+ {"__enter__", (PyCFunction)semlock_acquire, METH_VARARGS | METH_KEYWORDS,
"enter the semaphore/lock"},
{"__exit__", (PyCFunction)semlock_release, METH_VARARGS,
"exit the semaphore/lock"},
More information about the Python-checkins
mailing list