Mercurial > cpython-lru_cache-weakref
diff Modules/_threadmodule.c @ 69543:2c0da1c4f063
Issue #11915: threading.RLock()._release_save() raises a RuntimeError if the
lock was not acquired.
| author | Victor Stinner <victor.stinner@haypocalc.com> |
|---|---|
| date | Sun, 24 Apr 2011 23:41:33 +0200 |
| parents | 383a7301616b |
| children | 2b21fcf3d9a9 |
line wrap: on
line diff
--- a/Modules/_threadmodule.c Sun Apr 24 14:34:26 2011 -0700 +++ b/Modules/_threadmodule.c Sun Apr 24 23:41:33 2011 +0200 @@ -414,6 +414,12 @@ long owner; unsigned long count; + if (self->rlock_count == 0) { + PyErr_SetString(PyExc_RuntimeError, + "cannot release un-acquired lock"); + return NULL; + } + owner = self->rlock_owner; count = self->rlock_count; self->rlock_count = 0;
