diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2017-10-23 20:57:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-23 20:57:51 (GMT) |
commit | 828ca59208af0b1b52a328676c5cc0c5e2e999b0 (patch) | |
tree | 3fdd4425ec0281a14eb3e216bb826785c7593688 /Modules/_multiprocessing | |
parent | 62adc55aff0b78447568f73bd1abc610d2784bf8 (diff) | |
download | cpython-828ca59208af0b1b52a328676c5cc0c5e2e999b0.zip cpython-828ca59208af0b1b52a328676c5cc0c5e2e999b0.tar.gz cpython-828ca59208af0b1b52a328676c5cc0c5e2e999b0.tar.bz2 |
bpo-31653: Remove deadcode in semlock_acquire() (#4091)
Fix the following Coverity warning:
>>> CID 1420038: Control flow issues (DEADCODE)
>>> Execution cannot reach this statement: "res = sem_trywait(self->han...".
321 res = sem_trywait(self->handle);
The deadcode was introduced by the commit
c872d39d324cd6f1a71b73e10406bbaed192d35f.
Diffstat (limited to 'Modules/_multiprocessing')
-rw-r--r-- | Modules/_multiprocessing/semaphore.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/_multiprocessing/semaphore.c b/Modules/_multiprocessing/semaphore.c index 337e894..0092b13 100644 --- a/Modules/_multiprocessing/semaphore.c +++ b/Modules/_multiprocessing/semaphore.c @@ -315,12 +315,12 @@ semlock_acquire(SemLockObject *self, PyObject *args, PyObject *kwds) /* Couldn't acquire immediately, need to block */ do { Py_BEGIN_ALLOW_THREADS - if (blocking && timeout_obj == Py_None) + if (timeout_obj == Py_None) { res = sem_wait(self->handle); - else if (!blocking) - res = sem_trywait(self->handle); - else + } + else { res = sem_timedwait(self->handle, &deadline); + } Py_END_ALLOW_THREADS err = errno; if (res == MP_EXCEPTION_HAS_BEEN_SET) |