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

Method set_result

Lib/asyncio/futures.py:261–271  ·  view source on GitHub ↗

Mark the future done and set its result. If the future is already done when this method is called, raises InvalidStateError.

(self, result)

Source from the content-addressed store, hash-verified

259 # So-called internal methods (note: no set_running_or_notify_cancel()).
260
261 def set_result(self, result):
262 """Mark the future done and set its result.
263
264 If the future is already done when this method is called, raises
265 InvalidStateError.
266 """
267 if self._state != _PENDING:
268 raise exceptions.InvalidStateError(f'{self._state}: {self!r}')
269 self._result = result
270 self._state = _FINISHED
271 self.__schedule_callbacks()
272
273 def set_exception(self, exception):
274 """Mark the future done and set an exception.

Calls 1

__schedule_callbacksMethod · 0.95