MCPcopy Index your code
hub / github.com/python/cpython / set_exception

Method set_exception

Lib/concurrent/futures/_base.py:546–559  ·  view source on GitHub ↗

Sets the result of the future as being the given exception. Should only be used by Executor implementations and unit tests.

(self, exception)

Source from the content-addressed store, hash-verified

544 self._invoke_callbacks()
545
546 def set_exception(self, exception):
547 """Sets the result of the future as being the given exception.
548
549 Should only be used by Executor implementations and unit tests.
550 """
551 with self._condition:
552 if self._state in {CANCELLED, CANCELLED_AND_NOTIFIED, FINISHED}:
553 raise InvalidStateError('{}: {!r}'.format(self._state, self))
554 self._exception = exception
555 self._state = FINISHED
556 for waiter in self._waiters:
557 waiter.add_exception(self)
558 self._condition.notify_all()
559 self._invoke_callbacks()
560
561 def _get_snapshot(self):
562 """Get a snapshot of the future's current state.

Callers 5

runMethod · 0.45
_initializer_failedMethod · 0.45
process_result_itemMethod · 0.45
_terminate_brokenMethod · 0.45

Calls 5

_invoke_callbacksMethod · 0.95
InvalidStateErrorClass · 0.70
formatMethod · 0.45
add_exceptionMethod · 0.45
notify_allMethod · 0.45

Tested by

no test coverage detected