Commit f8d00855 authored by Jesse Noller's avatar Jesse Noller

merge 70783 to py3k

parent 6d4a9cf8
...@@ -548,6 +548,10 @@ class _TestLock(BaseTestCase): ...@@ -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):
......
...@@ -257,6 +257,7 @@ Dinu Gherman ...@@ -257,6 +257,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
...@@ -794,4 +795,3 @@ Siebren van der Zee ...@@ -794,4 +795,3 @@ Siebren van der Zee
Uwe Zessin Uwe Zessin
Tarek Ziad Tarek Ziad
Peter strand Peter strand
Jesse Noller
...@@ -49,6 +49,9 @@ Core and Builtins ...@@ -49,6 +49,9 @@ Core and Builtins
Library 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 - Issue #5236: Change time.strptime() to only take strings. Didn't work with
bytes already but the failure was non-obvious. bytes already but the failure was non-obvious.
......
...@@ -546,7 +546,7 @@ static PyMethodDef semlock_methods[] = { ...@@ -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"},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment