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

Method _make_cancelled_error

Lib/asyncio/futures.py:139–154  ·  view source on GitHub ↗

Create the CancelledError to raise if the Future is cancelled. This should only be called once when handling a cancellation since it erases the saved context exception value.

(self)

Source from the content-addressed store, hash-verified

137 return loop
138
139 def _make_cancelled_error(self):
140 """Create the CancelledError to raise if the Future is cancelled.
141
142 This should only be called once when handling a cancellation since
143 it erases the saved context exception value.
144 """
145 if self._cancelled_exc is not None:
146 exc = self._cancelled_exc
147 self._cancelled_exc = None
148 return exc
149
150 if self._cancel_message is None:
151 exc = exceptions.CancelledError()
152 else:
153 exc = exceptions.CancelledError(self._cancel_message)
154 return exc
155
156 def cancel(self, msg=None):
157 """Cancel the future and schedule callbacks.

Callers 4

resultMethod · 0.95
exceptionMethod · 0.95
__stepMethod · 0.80
_done_callbackFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected