diff --git a/docs/source/conf.py b/docs/source/conf.py index 6346b07009..1e4be4cae7 100755 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -171,7 +171,6 @@ def autodoc_process_signature( # currently undocumented things logger = getLogger("trio") UNDOCUMENTED = { - "trio.CancelScope.relative_deadline", "trio.MemorySendChannel", "trio.MemoryReceiveChannel", "trio.MemoryChannelStatistics", @@ -201,7 +200,9 @@ def autodoc_process_docstring( logger.warning(f"{name} has no docstring") else: if name in UNDOCUMENTED: - logger.warning("outdated list of undocumented things") + logger.warning( + f"outdated list of undocumented things in docs/source/conf.py: {name!r} has a docstring" + ) def setup(app: Sphinx) -> None: diff --git a/src/trio/_core/_run.py b/src/trio/_core/_run.py index 1552870ece..c2410150e1 100644 --- a/src/trio/_core/_run.py +++ b/src/trio/_core/_run.py @@ -802,6 +802,18 @@ def deadline(self, new_deadline: float) -> None: @property def relative_deadline(self) -> float: + """Read-write, :class:`float`. The number of seconds remaining until this + scope's deadline, relative to the current time. + + Defaults to :data:`math.inf` ("no deadline"). Must be non-negative. + + When modified + Before entering: sets the deadline relative to when the scope enters. + After entering: sets a new deadline relative to the current time. + + Raises: + RuntimeError: if trying to read or modify an unentered scope with an absolute deadline, i.e. when :attr:`is_relative` is ``False``. + """ if self._has_been_entered: return self._deadline - current_time() elif self._deadline != inf: