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)
| 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. |
no outgoing calls
no test coverage detected