summaryrefslogtreecommitdiffstats
path: root/Modules/_threadmodule.c
diff options
context:
space:
mode:
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 914d671..1aee77b 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;