Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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:
Expand Down
12 changes: 12 additions & 0 deletions src/trio/_core/_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading