bpo-33316: PyThread_release_lock always fails (GH-6541)

Use correct interpretation of return value from APIs.
This commit is contained in:
native-api 2019-02-02 19:22:55 +03:00 committed by Steve Dower
parent 00e9c55d27
commit 05e922136a
2 changed files with 4 additions and 2 deletions

View File

@ -0,0 +1 @@
PyThread_release_lock always fails

View File

@ -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;
}