Fixed threading.Condition.wait() incorrectly releases the mutex.