MCPcopy Index your code
hub / github.com/RustPython/RustPython / set_result

Method set_result

Lib/concurrent/futures/_base.py:537–550  ·  view source on GitHub ↗

Sets the return value of work associated with the future. Should only be used by Executor implementations and unit tests.

(self, result)

Source from the content-addressed store, hash-verified

535 raise RuntimeError('Future in unexpected state')
536
537 def set_result(self, result):
538 """Sets the return value of work associated with the future.
539
540 Should only be used by Executor implementations and unit tests.
541 """
542 with self._condition:
543 if self._state in {CANCELLED, CANCELLED_AND_NOTIFIED, FINISHED}:
544 raise InvalidStateError('{}: {!r}'.format(self._state, self))
545 self._result = result
546 self._state = FINISHED
547 for waiter in self._waiters:
548 waiter.add_result(self)
549 self._condition.notify_all()
550 self._invoke_callbacks()
551
552 def set_exception(self, exception):
553 """Sets the result of the future as being the given exception.

Callers 2

runMethod · 0.45
process_result_itemMethod · 0.45

Calls 5

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

Tested by

no test coverage detected