summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Noller <jnoller@gmail.com>2009-03-31 03:25:07 (GMT)
committerJesse Noller <jnoller@gmail.com>2009-03-31 03:25:07 (GMT)
commitf8d00855109d98d364882d46b2060a46af6456c3 (patch)
tree36a357b94a9067c5821bfa193f7f6b895723824c
parent6d4a9cf85f819188ed929302f0034974ebd051ed (diff)
downloadcpython-f8d00855109d98d364882d46b2060a46af6456c3.zip
cpython-f8d00855109d98d364882d46b2060a46af6456c3.tar.gz
cpython-f8d00855109d98d364882d46b2060a46af6456c3.tar.bz2
merge 70783 to py3k
-rw-r--r--Lib/test/test_multiprocessing.py4
-rw-r--r--Misc/ACKS2
-rw-r--r--Misc/NEWS3
-rw-r--r--Modules/_multiprocessing/semaphore.c2
4 files changed, 9 insertions, 2 deletions
diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py
index ed8c626..29f823d 100644
--- a/Lib/test/test_multiprocessing.py
+++ b/Lib/test/test_multiprocessing.py
@@ -548,6 +548,10 @@ class _TestLock(BaseTestCase):
self.assertEqual(lock.release(), None)
self.assertRaises((AssertionError, RuntimeError), lock.release)
+ def test_lock_context(self):
+ with self.Lock():
+ pass
+
class _TestSemaphore(BaseTestCase):
diff --git a/Misc/ACKS b/Misc/ACKS
index 03ed92d..bd300de 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -257,6 +257,7 @@ Dinu Gherman
Jonathan Giddy
Johannes Gijsbers
Michael Gilfix
+Tim Golden
Chris Gonnerman
David Goodger
Hans de Graaff
@@ -794,4 +795,3 @@ Siebren van der Zee
Uwe Zessin
Tarek ZiadŽ
Peter Åstrand
-Jesse Noller
diff --git a/Misc/NEWS b/Misc/NEWS
index de4245a..894aa71 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -49,6 +49,9 @@ Core and Builtins
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.
diff --git a/Modules/_multiprocessing/semaphore.c b/Modules/_multiprocessing/semaphore.c
index 9c8c445..40bd7c3 100644
--- a/Modules/_multiprocessing/semaphore.c
+++ b/Modules/_multiprocessing/semaphore.c
@@ -546,7 +546,7 @@ static PyMethodDef semlock_methods[] = {
"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"},