Skip to content

Commit 4463395

Browse files
committed
Fixes for CI
1 parent c0cf801 commit 4463395

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

docs/source/reference-lowlevel.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ Global statistics
5656
.. autoclass:: RunStatistics()
5757

5858

59+
.. _trio_contexts:
60+
5961
The current Trio context
6062
------------------------
6163

newsfragments/2757.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add :func:`trio.lowlevel.in_trio_run` and :func:`trio.lowlevel.in_trio_task` and document the semantics (and differences) thereof. See :ref:`the documentation <trio_contexts>`.

src/trio/_core/_run.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2953,10 +2953,18 @@ async def checkpoint_if_cancelled() -> None:
29532953

29542954

29552955
def in_trio_run() -> bool:
2956+
"""Check whether we are in a Trio run.
2957+
2958+
See also :ref:`the different types of contexts <trio_contexts>`.
2959+
"""
29562960
return hasattr(GLOBAL_RUN_CONTEXT, "runner")
29572961

29582962

29592963
def in_trio_task() -> bool:
2964+
"""Check whether we are in a Trio task.
2965+
2966+
See also :ref:`the different types of contexts <trio_contexts>`.
2967+
"""
29602968
return hasattr(GLOBAL_RUN_CONTEXT, "task")
29612969

29622970

0 commit comments

Comments
 (0)