python: fix i686 semaphore locking

Closes #5432
This commit is contained in:
Juergen Buchmueller 2016-12-31 17:48:59 +01:00
parent 10033d1ccf
commit ae9d21f98a
2 changed files with 20 additions and 1 deletions

View File

@ -0,0 +1,19 @@
Make sure sval is set before comparing it with self->maxvalue.
Compare only if the return value was zero.
This fixes "ValueError: semaphore or lock released too many times"
which occured only for i686.
--- Modules/_multiprocessing/semaphore.c 2016-12-17 21:05:07.000000000 +0100
+++ Modules/_multiprocessing/semaphore.c 2016-12-31 17:42:30.429238082 +0100
@@ -382,9 +382,10 @@
/* This check is not an absolute guarantee that the semaphore
does not rise above maxvalue. */
+ int res = sem_getvalue(self->handle, &sval);
if (sem_getvalue(self->handle, &sval) < 0) {
return PyErr_SetFromErrno(PyExc_OSError);
- } else if (sval >= self->maxvalue) {
+ } else if (res == 0 && sval >= self->maxvalue) {
PyErr_SetString(PyExc_ValueError, "semaphore or lock "
"released too many times");
return NULL;

View File

@ -4,7 +4,7 @@
#
pkgname=python
version=2.7.13
revision=1
revision=2
wrksrc="Python-${version}"
hostmakedepends="pkg-config"
makedepends="