MCPcopy
hub / github.com/python-trio/trio / CancelReason

Class CancelReason

src/trio/_core/_run.py:324–334  ·  view source on GitHub ↗

Attached to a :class:`CancelScope` upon cancellation with details of the source of the cancellation, which is then used to construct the string in a :exc:`Cancelled`. Users can pass a ``reason`` str to :meth:`CancelScope.cancel` to set it. Not publicly exported or documented.

Source from the content-addressed store, hash-verified

322
323@attrs.define
324class CancelReason:
325 """Attached to a :class:`CancelScope` upon cancellation with details of the source of the
326 cancellation, which is then used to construct the string in a :exc:`Cancelled`.
327 Users can pass a ``reason`` str to :meth:`CancelScope.cancel` to set it.
328
329 Not publicly exported or documented.
330 """
331
332 source: CancelReasonLiteral
333 source_task: str | None = None
334 reason: str | None = None
335
336
337@attrs.define(eq=False)

Callers 10

expireMethod · 0.85
__enter__Method · 0.85
cancelMethod · 0.85
cancel_calledMethod · 0.85
_child_finishedMethod · 0.85
abortedMethod · 0.85
task_exitedMethod · 0.85
initMethod · 0.85
checkpointFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…