From 05e922136a3286893bd489a8f2ecfa0dba4da368 Mon Sep 17 00:00:00 2001 From: native-api Date: Sat, 2 Feb 2019 19:22:55 +0300 Subject: bpo-33316: PyThread_release_lock always fails (GH-6541) Use correct interpretation of return value from APIs. --- Python/thread_nt.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Python/thread_nt.h') diff --git a/Python/thread_nt.h b/Python/thread_nt.h index 21ef5556a6..fdb192b7d7 100644 --- a/Python/thread_nt.h +++ b/Python/thread_nt.h @@ -104,8 +104,9 @@ LeaveNonRecursiveMutex(PNRMUTEX mutex) if (PyMUTEX_LOCK(&mutex->cs)) return FALSE; mutex->locked = 0; - result = PyCOND_SIGNAL(&mutex->cv); - result &= PyMUTEX_UNLOCK(&mutex->cs); + /* condvar APIs return 0 on success. We need to return TRUE on success. */ + result = !PyCOND_SIGNAL(&mutex->cv); + PyMUTEX_UNLOCK(&mutex->cs); return result; } -- cgit v1.2.1