diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-02-02 08:45:50 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-02 08:45:50 -0800 |
commit | c851dfc99b28c7335d42abd8250bb77c11ce23c0 (patch) | |
tree | 35d7bbe9c067efc5a7fc2108047271ea9c82972c /Python | |
parent | a2f4c4023314f69333d2e8cee68e316619f3d68e (diff) | |
download | cpython-git-c851dfc99b28c7335d42abd8250bb77c11ce23c0.tar.gz |
bpo-33316: PyThread_release_lock always fails (GH-6541)
Use correct interpretation of return value from APIs.
(cherry picked from commit 05e922136a3286893bd489a8f2ecfa0dba4da368)
Co-authored-by: native-api <ivan_pozdeev@mail.ru>
Diffstat (limited to 'Python')
-rw-r--r-- | Python/thread_nt.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/thread_nt.h b/Python/thread_nt.h index 61fa8619bc..56295d0e8c 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; } |