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

jesse.noller python-checkins at python.org
Tue Mar 31 05:25:08 CEST 2009


Author: jesse.noller
Date: Tue Mar 31 05:25:07 2009
New Revision: 70791

Log:
merge 70783 to py3k

Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Lib/test/test_multiprocessing.py
   python/branches/py3k/Misc/ACKS
   python/branches/py3k/Misc/NEWS
   python/branches/py3k/Modules/_multiprocessing/semaphore.c

Modified: python/branches/py3k/Lib/test/test_multiprocessing.py
==============================================================================
--- python/branches/py3k/Lib/test/test_multiprocessing.py	(original)
+++ python/branches/py3k/Lib/test/test_multiprocessing.py	Tue Mar 31 05:25:07 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/py3k/Misc/ACKS
==============================================================================
--- python/branches/py3k/Misc/ACKS	(original)
+++ python/branches/py3k/Misc/ACKS	Tue Mar 31 05:25:07 2009
@@ -257,6 +257,7 @@
 Jonathan Giddy
 Johannes Gijsbers
 Michael Gilfix
+Tim Golden
 Chris Gonnerman
 David Goodger
 Hans de Graaff
@@ -794,4 +795,3 @@
 Uwe Zessin
 Tarek ZiadŽ
 Peter Åstrand
-Jesse Noller

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Tue Mar 31 05:25:07 2009
@@ -49,6 +49,9 @@
 Library
 -------
 
+- Issue #5261: Patch multiprocessing's semaphore.c to support context
+  manager use: "with multiprocessing.Lock()" works now.
+
 - Issue #5236: Change time.strptime() to only take strings. Didn't work with
   bytes already but the failure was non-obvious.
 

Modified: python/branches/py3k/Modules/_multiprocessing/semaphore.c
==============================================================================
--- python/branches/py3k/Modules/_multiprocessing/semaphore.c	(original)
+++ python/branches/py3k/Modules/_multiprocessing/semaphore.c	Tue Mar 31 05:25:07 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