[Python-checkins] bpo-33316: PyThread_release_lock always fails (GH-6541)
Miss Islington (bot)
webhook-mailer at python.org
Sat Feb 2 11:45:54 EST 2019
https://github.com/python/cpython/commit/c851dfc99b28c7335d42abd8250bb77c11ce23c0
commit: c851dfc99b28c7335d42abd8250bb77c11ce23c0
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2019-02-02T08:45:50-08:00
summary:
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 at mail.ru>
files:
A Misc/NEWS.d/next/Windows/2018-04-20-03-24-07.bpo-33316.9IiJ8J.rst
M Python/thread_nt.h
diff --git a/Misc/NEWS.d/next/Windows/2018-04-20-03-24-07.bpo-33316.9IiJ8J.rst b/Misc/NEWS.d/next/Windows/2018-04-20-03-24-07.bpo-33316.9IiJ8J.rst
new file mode 100644
index 000000000000..55176791a901
--- /dev/null
+++ b/Misc/NEWS.d/next/Windows/2018-04-20-03-24-07.bpo-33316.9IiJ8J.rst
@@ -0,0 +1 @@
+PyThread_release_lock always fails
diff --git a/Python/thread_nt.h b/Python/thread_nt.h
index 61fa8619bc17..56295d0e8c0f 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;
}
More information about the Python-checkins
mailing list