@@ -68,7 +68,7 @@ lock_PyThread_acquire_lock(lockobject *self, PyObject *args)
6868
6969PyDoc_STRVAR (acquire_doc ,
7070"acquire([wait]) -> None or bool\n\
71- (PyThread_acquire_lock () is an obsolete synonym)\n\
71+ (acquire_lock () is an obsolete synonym)\n\
7272\n\
7373Lock the lock. Without argument, this blocks if the lock is already\n\
7474locked (even by the same thread), waiting for another thread to release\n\
@@ -94,7 +94,7 @@ lock_PyThread_release_lock(lockobject *self)
9494
9595PyDoc_STRVAR (release_doc ,
9696"release()\n\
97- (PyThread_release_lock () is an obsolete synonym)\n\
97+ (release_lock () is an obsolete synonym)\n\
9898\n\
9999Release the lock, allowing another thread that is blocked waiting for\n\
100100the lock to acquire the lock. The lock must be in the locked state,\n\
@@ -123,29 +123,6 @@ lock_context(lockobject *self)
123123 return (PyObject * )self ;
124124}
125125
126- PyDoc_STRVAR (lock_exit_doc ,
127- "__exit__(type, value, tb)\n\
128- \n\
129- Releases the lock; then re-raises the exception if type is not None." );
130-
131- static PyObject *
132- lock_exit (lockobject * self , PyObject * args )
133- {
134- PyObject * type , * value , * tb , * result ;
135- if (!PyArg_ParseTuple (args , "OOO:__exit__" , & type , & value , & tb ))
136- return NULL ;
137- result = lock_PyThread_release_lock (self );
138- if (result != NULL && type != Py_None ) {
139- Py_DECREF (result );
140- result = NULL ;
141- Py_INCREF (type );
142- Py_INCREF (value );
143- Py_INCREF (tb );
144- PyErr_Restore (type , value , tb );
145- }
146- return result ;
147- }
148-
149126static PyMethodDef lock_methods [] = {
150127 {"acquire_lock" , (PyCFunction )lock_PyThread_acquire_lock ,
151128 METH_VARARGS , acquire_doc },
@@ -163,8 +140,8 @@ static PyMethodDef lock_methods[] = {
163140 METH_NOARGS , PyDoc_STR ("__context__() -> self." )},
164141 {"__enter__" , (PyCFunction )lock_PyThread_acquire_lock ,
165142 METH_VARARGS , acquire_doc },
166- {"__exit__" , (PyCFunction )lock_exit ,
167- METH_VARARGS , lock_exit_doc },
143+ {"__exit__" , (PyCFunction )lock_PyThread_release_lock ,
144+ METH_VARARGS , release_doc },
168145 {NULL , NULL } /* sentinel */
169146};
170147
0 commit comments