merge 70783 to py3k

This commit is contained in:
Jesse Noller 2009-03-31 03:25:07 +00:00
parent 6d4a9cf85f
commit f8d0085510
4 changed files with 9 additions and 2 deletions

View File

@ -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):

View File

@ -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

View File

@ -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.

View File

@ -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"},