summaryrefslogtreecommitdiff
path: root/Modules/_threadmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-04-24 23:41:33 +0200
committerVictor Stinner <victor.stinner@haypocalc.com>2011-04-24 23:41:33 +0200
commitc2824d41c32c3be5f100acdb1ff9f71ba7336b60 (patch)
treeecc2204a2c49dbbb3eba73212218fbf244b725a9 /Modules/_threadmodule.c
parenta82aa55b5e5448f93fd1827d97752e19877db077 (diff)
downloadcpython-git-c2824d41c32c3be5f100acdb1ff9f71ba7336b60.tar.gz
Issue #11915: threading.RLock()._release_save() raises a RuntimeError if the
lock was not acquired.
Diffstat (limited to 'Modules/_threadmodule.c')
-rw-r--r--Modules/_threadmodule.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c
index 914d671d6a..1aee77b5f7 100644
--- a/Modules/_threadmodule.c
+++ b/Modules/_threadmodule.c
@@ -414,6 +414,12 @@ rlock_release_save(rlockobject *self)
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;