Sets the result of the future as being the given exception. Should only be used by Executor implementations and unit tests.
(self, exception)
| 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. |
no test coverage detected