Sets the result of the future as being the given exception
        and traceback.

        Should only be used by Executor implementations and unit tests.
776660
def set_exception_info(self, exception, traceback):
        
        with self._condition:
            self._exception = exception
            self._traceback = traceback
            self._state = FINISHED
            for waiter in self._waiters:
                waiter.add_exception(self)
            self._condition.notify_all()
        self._invoke_callbacks()
982504
public boolean setException(TBase<?, ?> result, Throwable cause) {
        final Class<?> causeType = cause.getClass();
        for (Entry<Class<Throwable>, TFieldIdEnum> e : exceptionFields.entrySet()) {
            if (e.getKey().isAssignableFrom(causeType)) {
                ThriftFieldAccess.set(result, e.getValue(), cause);
                return true;
            }
        }
        return false;
    }
503045
private void complete(T result, Throwable error) {
    synchronized (orderedFutures) {
      this.result = result;
      this.error = error;
      this.complete = true;
      if (error == null) {
        for (CompletableFuture<T> future : orderedFutures) {
          future.complete(result);
        }
      } else {
        for (CompletableFuture<T> future : orderedFutures) {
          future.completeExceptionally(error);
        }
      }
      orderedFutures.clear();
    }
  }
1253923
protected boolean setResult(Object result) {
        for (; ; ) {
            Object currentState = this.state;

            if (isDoneState(currentState)) {
                return false;
            }

            if (STATE.compareAndSet(this, currentState, result)) {
                done();
                notifyThreadsWaitingOnGet();
                runAsynchronous((ExecutionCallbackNode) currentState, result);
                break;
            }
        }
        return true;
    }
1259220
def set_exception(self, exception):
        """"""
        self.set_exc_info(
            (exception.__class__,
             exception,
             getattr(exception, '__traceback__', None)))
521519
def set_executor(self, executor: futures.Executor):
        
        self.loop.set_default_executor(executor)
        self._func_executor = executor
        return True
1063993
public static <U> CompletableFuture<U> failedFuture(Throwable ex) {
        if (ex == null) throw new NullPointerException();
        return new CompletableFuture<U>(new AltResult(ex));
    }
254269
def set_exception(self, exception, traceback=None):
        
        if not isinstance(exception, BaseException):
            raise RuntimeError("Exception must be of BaseException type")
        self._exception = exception
        self._traceback = traceback
        self._event.set()
        self._invoke_callbacks()
929628
def gather(self, futures, consume_exceptions=True):
        

        # from the asyncio docs: "If return_exceptions is True, exceptions
        # in the tasks are treated the same as successful results, and
        # gathered in the result list; otherwise, the first raised
        # exception will be immediately propagated to the returned
        # future."
        return asyncio.gather(*futures, return_exceptions=consume_exceptions)
1279146
public static <T> ThriftCompletableFuture<T> failedCompletedFuture(Exception e) {
        final ThriftCompletableFuture<T> future = new ThriftCompletableFuture<>();
        future.onError(e);
        return future;
    }
380955
def setThrowException(self, setting):
        
        if setting:
            self._throwException = True
            self._findFailedResponse = "ABORT"
        else:
            self._throwException = False
            self._findFailedResponse = "SKIP"
520220
def set(self):
        
        self._flag = True
        old_future = self._waiting_future
        # Replace _waiting_future with a fresh one incase someone woken up by set_result()
        # sets this AsyncEvent to False before waiting on it to be set again.
        self._waiting_future = tornado_Future()
        old_future.set_result(True)
698875
def _set_concurrent_future_state(concurrent, source):
    """"""
    assert source.done()
    if source.cancelled():
        concurrent.cancel()
    if not concurrent.set_running_or_notify_cancel():
        return
    exception = source.exception()
    if exception is not None:
        concurrent.set_exception(exception)
    else:
        result = source.result()
        concurrent.set_result(result)
1099399
def set_result(self, key, result):
        """"""
        self.results[key] = result
        if self.yield_point is not None and self.yield_point.is_ready():
            try:
                self.future.set_result(self.yield_point.get_result())
            except:
                self.future.set_exc_info(sys.exc_info())
            self.yield_point = None
            self.run()
1323370
def create_failure(self, exception=None):
        
        if exception:
            return FailedFuture(type(exception), exception, None)
        return FailedFuture(*sys.exc_info())
336494
public void setExecutionException(final ExecutionException executionException) {
        // Only set the execution exception once
        if (executionException != null && thrownExecutionException.get() == null) {
            thrownExecutionException.compareAndSet(/* expectedValue = */ null, executionException);
        }
    }
137774
protected void setFuture(final Future<?> future) {
	final long stamp = lock.writeLock();
	try {
	    this.future = future;
	} finally {
	    lock.unlockWrite(stamp);
	}
    }