[Python-checkins] r70784 - in python/branches/release26-maint: Lib/test/test_multiprocessing.py Misc/ACKS Misc/NEWS Modules/_multiprocessing/semaphore.c

jesse.noller python-checkins at python.org
Tue Mar 31 01:38:36 CEST 2009


Author: jesse.noller
Date: Tue Mar 31 01:38:36 2009
New Revision: 70784
Log:
merge 70783 back to 26maint
Modified:
 python/branches/release26-maint/ (props changed)
 python/branches/release26-maint/Lib/test/test_multiprocessing.py
 python/branches/release26-maint/Misc/ACKS
 python/branches/release26-maint/Misc/NEWS
 python/branches/release26-maint/Modules/_multiprocessing/semaphore.c
Modified: python/branches/release26-maint/Lib/test/test_multiprocessing.py
==============================================================================
--- python/branches/release26-maint/Lib/test/test_multiprocessing.py	(original)
+++ python/branches/release26-maint/Lib/test/test_multiprocessing.py	Tue Mar 31 01:38:36 2009
@@ -548,6 +548,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/branches/release26-maint/Misc/ACKS
==============================================================================
--- python/branches/release26-maint/Misc/ACKS	(original)
+++ python/branches/release26-maint/Misc/ACKS	Tue Mar 31 01:38:36 2009
@@ -251,6 +251,7 @@
 Jonathan Giddy
 Johannes Gijsbers
 Michael Gilfix
+Tim Golden
 Chris Gonnerman
 David Goodger
 Hans de Graaff
Modified: python/branches/release26-maint/Misc/NEWS
==============================================================================
--- python/branches/release26-maint/Misc/NEWS	(original)
+++ python/branches/release26-maint/Misc/NEWS	Tue Mar 31 01:38:36 2009
@@ -92,6 +92,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/branches/release26-maint/Modules/_multiprocessing/semaphore.c
==============================================================================
--- python/branches/release26-maint/Modules/_multiprocessing/semaphore.c	(original)
+++ python/branches/release26-maint/Modules/_multiprocessing/semaphore.c	Tue Mar 31 01:38:36 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

AltStyle によって変換されたページ (->オリジナル) /