Sets the result of the future as being the given exception. Should only be used by Executor implementations and unit tests.
(self, exception)
| 550 | self._invoke_callbacks() |
| 551 | |
| 552 | def set_exception(self, exception): |
| 553 | """Sets the result of the future as being the given exception. |
| 554 | |
| 555 | Should only be used by Executor implementations and unit tests. |
| 556 | """ |
| 557 | with self._condition: |
| 558 | if self._state in {CANCELLED, CANCELLED_AND_NOTIFIED, FINISHED}: |
| 559 | raise InvalidStateError('{}: {!r}'.format(self._state, self)) |
| 560 | self._exception = exception |
| 561 | self._state = FINISHED |
| 562 | for waiter in self._waiters: |
| 563 | waiter.add_exception(self) |
| 564 | self._condition.notify_all() |
| 565 | self._invoke_callbacks() |
| 566 | |
| 567 | __class_getitem__ = classmethod(types.GenericAlias) |
| 568 |
no test coverage detected