chunk_id stringlengths 36 36 | source stringclasses 35
values | source_url stringlengths 0 290 | upstream_license stringclasses 1
value | document_id stringlengths 36 36 | chunk_index int64 0 324k | retrieved_at stringclasses 2
values | chunker_version stringclasses 4
values | content_hash stringlengths 15 64 | content stringlengths 50 44.7k | namespace stringclasses 9
values | source_name stringclasses 35
values | raw_text stringlengths 50 44.7k | cleaned_text stringlengths 50 44.7k | tags stringclasses 49
values | collection_name stringclasses 11
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
10453d28-9573-4bcb-86bb-c67f9efd2874 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,096 | supabase-export-v2 | aa5e627fe5adc94c | can proceed to the next ``yield`` of a generator by using the built-in function :func:`next`. In other words, the generator runs, then pauses. For example::
>>> generator = get_random_number()
>>> next(generator)
Hi
1
>>> next(generator)
Hello
7 | trusted_official_docs | CPython Docs | can proceed to the next ``yield`` of a generator by using the built-in function :func:`next`. In other words, the generator runs, then pauses. For example::
>>> generator = get_random_number()
>>> next(generator)
Hi
1
>>> next(generator)
Hello
7 | can proceed to the next ``yield`` of a generator by using the built-in function :func:`next`. In other words, the generator runs, then pauses. For example::
>>> generator = get_random_number()
>>> next(generator)
Hi
1
>>> next(generator)
Hello
7 | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1a3f0339-c1e5-475c-8c5b-2ac489353623 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,151 | supabase-export-v2 | 60d47408a9fdc477 | executes the remaining statements in its body. When a coroutine finishes, it raises a :exc:`StopIteration` exception with the return value attached in the :attr:`~StopIteration.value` attribute.
That snippet produces this output: | trusted_official_docs | CPython Docs | executes the remaining statements in its body. When a coroutine finishes, it raises a :exc:`StopIteration` exception with the return value attached in the :attr:`~StopIteration.value` attribute.
That snippet produces this output: | executes the remaining statements in its body. When a coroutine finishes, it raises a :exc:`StopIteration` exception with the return value attached in the :attr:`~StopIteration.value` attribute.
That snippet produces this output: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1f4fc657-18c0-4b6a-9644-a41c395cdf4c | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,076 | supabase-export-v2 | ba05bba74de1ad60 | avoid needlessly wasting CPU cycles, and will come back when there's more work to be done, such as when I/O operations complete or timers expire.
Effective execution relies on jobs sharing well and cooperating; a greedy job
could hog control and leave the other jobs to starve, rendering the overall
event loop approach ... | trusted_official_docs | CPython Docs | avoid needlessly wasting CPU cycles, and will come back when there's more work to be done, such as when I/O operations complete or timers expire.
Effective execution relies on jobs sharing well and cooperating; a greedy job
could hog control and leave the other jobs to starve, rendering the overall
event loop approach ... | avoid needlessly wasting CPU cycles, and will come back when there's more work to be done, such as when I/O operations complete or timers expire.
Effective execution relies on jobs sharing well and cooperating; a greedy job
could hog control and leave the other jobs to starve, rendering the overall
event loop approach ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
258d93e7-af56-463d-86dd-bf825f0fe0ca | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,107 | supabase-export-v2 | 4cfd8a67ce8f44e4 | if __name__ == "__main__": asyncio.run(main()) # The program will not reach the following print statement until the # coroutine main() finishes. print("coroutine main() is done!")
It's important to be aware that the task itself is not added to the event loop,
only a callback to the task is. This matters if the task obj... | trusted_official_docs | CPython Docs | if __name__ == "__main__": asyncio.run(main()) # The program will not reach the following print statement until the # coroutine main() finishes. print("coroutine main() is done!")
It's important to be aware that the task itself is not added to the event loop,
only a callback to the task is. This matters if the task obj... | if __name__ == "__main__": asyncio.run(main()) # The program will not reach the following print statement until the # coroutine main() finishes. print("coroutine main() is done!")
It's important to be aware that the task itself is not added to the event loop,
only a callback to the task is. This matters if the task obj... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2bbfde9a-26cd-4edc-9714-c8c555ad0a66 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,159 | supabase-export-v2 | 3c2ea7b049cdf577 | ======= Futures =======
A :ref:`future <asyncio-future-obj>` is an object meant to represent a
computation's status and result. The term is a nod to the idea of something still to come or not yet happened,
and the object is a way to keep an eye on that something. | trusted_official_docs | CPython Docs | ======= Futures =======
A :ref:`future <asyncio-future-obj>` is an object meant to represent a
computation's status and result. The term is a nod to the idea of something still to come or not yet happened,
and the object is a way to keep an eye on that something. | ======= Futures =======
A :ref:`future <asyncio-future-obj>` is an object meant to represent a
computation's status and result. The term is a nod to the idea of something still to come or not yet happened,
and the object is a way to keep an eye on that something. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
32369bfe-3574-49cc-8230-6e6d8395e5cd | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,153 | supabase-export-v2 | 74385a28ef19e49c | .. code-block:: none
Beginning coroutine main(). Awaiting rock... Coroutine paused and returned intermediate value: 7. Resuming coroutine and sending in value: 42. Rock.__await__ resuming with value: 42. Coroutine received value: 42 from rock. Coroutine main() finished and provided value: 23. | trusted_official_docs | CPython Docs | .. code-block:: none
Beginning coroutine main(). Awaiting rock... Coroutine paused and returned intermediate value: 7. Resuming coroutine and sending in value: 42. Rock.__await__ resuming with value: 42. Coroutine received value: 42 from rock. Coroutine main() finished and provided value: 23. | .. code-block:: none
Beginning coroutine main(). Awaiting rock... Coroutine paused and returned intermediate value: 7. Resuming coroutine and sending in value: 42. Rock.__await__ resuming with value: 42. Coroutine received value: 42 from rock. Coroutine main() finished and provided value: 23. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
32eb1a1b-4ee9-497b-ab82-e344645a2a3a | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,066 | supabase-export-v2 | 2a82d77ba11c6422 | seeks to help you build a sturdy mental model of how :mod:`asyncio` fundamentally works, helping you understand the how and why behind the recommended patterns.
You might be curious about some key :mod:`!asyncio` concepts. By the end of this article, you'll be able to comfortably answer these questions: | trusted_official_docs | CPython Docs | seeks to help you build a sturdy mental model of how :mod:`asyncio` fundamentally works, helping you understand the how and why behind the recommended patterns.
You might be curious about some key :mod:`!asyncio` concepts. By the end of this article, you'll be able to comfortably answer these questions: | seeks to help you build a sturdy mental model of how :mod:`asyncio` fundamentally works, helping you understand the how and why behind the recommended patterns.
You might be curious about some key :mod:`!asyncio` concepts. By the end of this article, you'll be able to comfortably answer these questions: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
38a067ba-87a8-4166-b404-04e5a9389518 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,106 | supabase-export-v2 | e5aa404be82f1be2 | async def main(): # Perform all sorts of wacky, wild asynchronous things... ...
if __name__ == "__main__":
asyncio.run(main())
# The program will not reach the following print statement until the
# coroutine main() finishes. print("coroutine main() is done!") | trusted_official_docs | CPython Docs | async def main(): # Perform all sorts of wacky, wild asynchronous things... ...
if __name__ == "__main__":
asyncio.run(main())
# The program will not reach the following print statement until the
# coroutine main() finishes. print("coroutine main() is done!") | async def main(): # Perform all sorts of wacky, wild asynchronous things... ...
if __name__ == "__main__":
asyncio.run(main())
# The program will not reach the following print statement until the
# coroutine main() finishes. print("coroutine main() is done!") | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3b840384-31bc-4599-9d92-f6d68ad225c1 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,071 | supabase-export-v2 | 9c5140459339ca8e | -------------------------------------------- A conceptual overview part 1: the high-level --------------------------------------------
In part 1, we'll cover the main, high-level building blocks of :mod:`!asyncio`:
the event loop, coroutine functions, coroutine objects, tasks, and ``await``. | trusted_official_docs | CPython Docs | -------------------------------------------- A conceptual overview part 1: the high-level --------------------------------------------
In part 1, we'll cover the main, high-level building blocks of :mod:`!asyncio`:
the event loop, coroutine functions, coroutine objects, tasks, and ``await``. | -------------------------------------------- A conceptual overview part 1: the high-level --------------------------------------------
In part 1, we'll cover the main, high-level building blocks of :mod:`!asyncio`:
the event loop, coroutine functions, coroutine objects, tasks, and ``await``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3d6030bb-ea03-4978-bea1-8c17dd19b9be | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,179 | supabase-export-v2 | 077a6d4c064a1d8e | .. code-block:: none
$ python custom-async-sleep.py
Beginning asynchronous sleep at time: 14:52:22. I like work. Work work. I like work. Work work. I like work. Work work. Done asynchronous sleep at time: 14:52:25. | trusted_official_docs | CPython Docs | .. code-block:: none
$ python custom-async-sleep.py
Beginning asynchronous sleep at time: 14:52:22. I like work. Work work. I like work. Work work. I like work. Work work. Done asynchronous sleep at time: 14:52:25. | .. code-block:: none
$ python custom-async-sleep.py
Beginning asynchronous sleep at time: 14:52:22. I like work. Work work. I like work. Work work. I like work. Work work. Done asynchronous sleep at time: 14:52:25. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3e48404d-e37b-4d8e-9b6a-3029dfe1d1c7 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,180 | supabase-export-v2 | 4f7de2ff1d35346c | sleep at time: 14:52:22. I like work. Work work. I like work. Work work. I like work. Work work. Done asynchronous sleep at time: 14:52:25.
You might feel this implementation of asynchronous sleep was unnecessarily
convoluted. And, well, it was. The example was meant to showcase the versatility of futures with a simple... | trusted_official_docs | CPython Docs | sleep at time: 14:52:22. I like work. Work work. I like work. Work work. I like work. Work work. Done asynchronous sleep at time: 14:52:25.
You might feel this implementation of asynchronous sleep was unnecessarily
convoluted. And, well, it was. The example was meant to showcase the versatility of futures with a simple... | sleep at time: 14:52:22. I like work. Work work. I like work. Work work. I like work. Work work. Done asynchronous sleep at time: 14:52:25.
You might feel this implementation of asynchronous sleep was unnecessarily
convoluted. And, well, it was. The example was meant to showcase the versatility of futures with a simple... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
404a4943-4033-428d-a2b4-a828b1bd4833 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,139 | supabase-export-v2 | 6364c0bea1cad5e0 | next job. That might sound minor, but in a large program with many ``await``\ s, that overhead can add up to a non-negligible performance drag.
------------------------------------------------
A conceptual overview part 2: the nuts and bolts
------------------------------------------------ | trusted_official_docs | CPython Docs | next job. That might sound minor, but in a large program with many ``await``\ s, that overhead can add up to a non-negligible performance drag.
------------------------------------------------
A conceptual overview part 2: the nuts and bolts
------------------------------------------------ | next job. That might sound minor, but in a large program with many ``await``\ s, that overhead can add up to a non-negligible performance drag.
------------------------------------------------
A conceptual overview part 2: the nuts and bolts
------------------------------------------------ | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4170fdd3-026f-4140-90b8-27636abbafab | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,090 | supabase-export-v2 | e4e4cf9cb50257fe | precisely, an instance of :data:`types.CoroutineType` (native coroutine). Note that coroutines can also exist as instances of :class:`collections.abc.Coroutine` -- a distinction that matters for type checking.
A coroutine represents the function's body or logic. A coroutine has to be explicitly started; again, merely c... | trusted_official_docs | CPython Docs | precisely, an instance of :data:`types.CoroutineType` (native coroutine). Note that coroutines can also exist as instances of :class:`collections.abc.Coroutine` -- a distinction that matters for type checking.
A coroutine represents the function's body or logic. A coroutine has to be explicitly started; again, merely c... | precisely, an instance of :data:`types.CoroutineType` (native coroutine). Note that coroutines can also exist as instances of :class:`collections.abc.Coroutine` -- a distinction that matters for type checking.
A coroutine represents the function's body or logic. A coroutine has to be explicitly started; again, merely c... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4345bf42-94f1-431b-804f-8719f3a9b3b9 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,081 | supabase-export-v2 | 590b837cc5d2563d | This is a basic, boring Python function::
def hello_printer():
print(
"Hi, I am a lowly, simple printer, though I have all I "
"need in life -- \nfresh paper and my dearly beloved octopus "
"partner in crime."
) | trusted_official_docs | CPython Docs | This is a basic, boring Python function::
def hello_printer():
print(
"Hi, I am a lowly, simple printer, though I have all I "
"need in life -- \nfresh paper and my dearly beloved octopus "
"partner in crime."
) | This is a basic, boring Python function::
def hello_printer():
print(
"Hi, I am a lowly, simple printer, though I have all I "
"need in life -- \nfresh paper and my dearly beloved octopus "
"partner in crime."
) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
43db5f9c-4675-4eac-822c-1c77e0279b7b | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,181 | supabase-export-v2 | 529095612f2f12d4 | versatility of futures with a simple example that could be mimicked for more complex needs. For reference, you could implement it without futures, like so::
async def simpler_async_sleep(seconds):
time_to_wake = time.time() + seconds
while True:
if time.time() >= time_to_wake:
return
else:
await YieldToEventLoop(... | trusted_official_docs | CPython Docs | versatility of futures with a simple example that could be mimicked for more complex needs. For reference, you could implement it without futures, like so::
async def simpler_async_sleep(seconds):
time_to_wake = time.time() + seconds
while True:
if time.time() >= time_to_wake:
return
else:
await YieldToEventLoop(... | versatility of futures with a simple example that could be mimicked for more complex needs. For reference, you could implement it without futures, like so::
async def simpler_async_sleep(seconds):
time_to_wake = time.time() + seconds
while True:
if time.time() >= time_to_wake:
return
else:
await YieldToEventLoop(... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4a05a8ac-de82-46fa-99e6-5b2114250e23 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,083 | supabase-export-v2 | 58a910dea12ea8fd | Calling a regular function invokes its logic or body::
>>> hello_printer()
Hi, I am a lowly, simple printer, though I have all I need in life --
fresh paper and my dearly beloved octopus partner in crime. | trusted_official_docs | CPython Docs | Calling a regular function invokes its logic or body::
>>> hello_printer()
Hi, I am a lowly, simple printer, though I have all I need in life --
fresh paper and my dearly beloved octopus partner in crime. | Calling a regular function invokes its logic or body::
>>> hello_printer()
Hi, I am a lowly, simple printer, though I have all I need in life --
fresh paper and my dearly beloved octopus partner in crime. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
55bd897e-faa5-40df-b877-a366eb028190 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,162 | supabase-export-v2 | 6024cef5b5c7d602 | prior section said tasks store a list of callbacks, which wasn't entirely accurate. It's actually the ``Future`` class that implements this logic, which ``Task`` inherits.
Futures may also be used directly (not via tasks). Tasks mark themselves as done when their coroutine is complete. Futures are much more versatile a... | trusted_official_docs | CPython Docs | prior section said tasks store a list of callbacks, which wasn't entirely accurate. It's actually the ``Future`` class that implements this logic, which ``Task`` inherits.
Futures may also be used directly (not via tasks). Tasks mark themselves as done when their coroutine is complete. Futures are much more versatile a... | prior section said tasks store a list of callbacks, which wasn't entirely accurate. It's actually the ``Future`` class that implements this logic, which ``Task`` inherits.
Futures may also be used directly (not via tasks). Tasks mark themselves as done when their coroutine is complete. Futures are much more versatile a... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
587614bf-81bc-418e-9bc8-f8d71f6a2f83 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,137 | supabase-export-v2 | 03118d7dc880b4d7 | I am coro_b(). I sure hope no one hogs the event loop... I am coro_a(). Hi! I am coro_a(). Hi! I am coro_a(). Hi!
This behavior of ``await coroutine`` can trip a lot of people up! That example highlights how using only ``await coroutine`` could
unintentionally hog control from other tasks and effectively stall the even... | trusted_official_docs | CPython Docs | I am coro_b(). I sure hope no one hogs the event loop... I am coro_a(). Hi! I am coro_a(). Hi! I am coro_a(). Hi!
This behavior of ``await coroutine`` can trip a lot of people up! That example highlights how using only ``await coroutine`` could
unintentionally hog control from other tasks and effectively stall the even... | I am coro_b(). I sure hope no one hogs the event loop... I am coro_a(). Hi! I am coro_a(). Hi! I am coro_a(). Hi!
This behavior of ``await coroutine`` can trip a lot of people up! That example highlights how using only ``await coroutine`` could
unintentionally hog control from other tasks and effectively stall the even... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
591e966f-2da6-47a3-afa6-d36ce70c98a8 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,118 | supabase-export-v2 | f48a064f876cb7f7 | ^^^^^^^^^^^^^^ Awaiting tasks ^^^^^^^^^^^^^^
Awaiting a task will cede control from the current task or coroutine to
the event loop. In the process of relinquishing control, a few important things happen. We'll use the following code example to illustrate:: | trusted_official_docs | CPython Docs | ^^^^^^^^^^^^^^ Awaiting tasks ^^^^^^^^^^^^^^
Awaiting a task will cede control from the current task or coroutine to
the event loop. In the process of relinquishing control, a few important things happen. We'll use the following code example to illustrate:: | ^^^^^^^^^^^^^^ Awaiting tasks ^^^^^^^^^^^^^^
Awaiting a task will cede control from the current task or coroutine to
the event loop. In the process of relinquishing control, a few important things happen. We'll use the following code example to illustrate:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5ac924ca-30bd-461b-b999-d449789b4c40 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,129 | supabase-export-v2 | e796ad36ece88410 | async def coro_b(): print("I am coro_b(). I sure hope no one hogs the event loop...")
async def main():
task_b = asyncio.create_task(coro_b())
num_repeats = 3
for _ in range(num_repeats):
await coro_a()
await task_b | trusted_official_docs | CPython Docs | async def coro_b(): print("I am coro_b(). I sure hope no one hogs the event loop...")
async def main():
task_b = asyncio.create_task(coro_b())
num_repeats = 3
for _ in range(num_repeats):
await coro_a()
await task_b | async def coro_b(): print("I am coro_b(). I sure hope no one hogs the event loop...")
async def main():
task_b = asyncio.create_task(coro_b())
num_repeats = 3
for _ in range(num_repeats):
await coro_a()
await task_b | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5d833c4b-78f7-45ff-a2b9-4bf763dc2146 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,150 | supabase-export-v2 | a8b8b02bb4bb3c19 | propagates (or "passes along") any ``yield``\ s it receives up the call chain. In this case, that's back to ``... = coroutine.send(None)`` on line 16.
The coroutine is resumed via the ``coroutine.send(42)`` call on line 21. The coroutine picks back up from where it ``yield``\ ed (or paused) on line 3
and executes the r... | trusted_official_docs | CPython Docs | propagates (or "passes along") any ``yield``\ s it receives up the call chain. In this case, that's back to ``... = coroutine.send(None)`` on line 16.
The coroutine is resumed via the ``coroutine.send(42)`` call on line 21. The coroutine picks back up from where it ``yield``\ ed (or paused) on line 3
and executes the r... | propagates (or "passes along") any ``yield``\ s it receives up the call chain. In this case, that's back to ``... = coroutine.send(None)`` on line 16.
The coroutine is resumed via the ``coroutine.send(42)`` call on line 21. The coroutine picks back up from where it ``yield``\ ed (or paused) on line 3
and executes the r... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5dab834e-59e3-4e4d-8100-f95032b28f36 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,160 | supabase-export-v2 | 76780a1ee904b5c8 | to the idea of something still to come or not yet happened, and the object is a way to keep an eye on that something.
A future has a few important attributes. One is its state, which can be either
"pending", "cancelled", or "done". Another is its result, which is set when the state transitions to done. Unlike a corouti... | trusted_official_docs | CPython Docs | to the idea of something still to come or not yet happened, and the object is a way to keep an eye on that something.
A future has a few important attributes. One is its state, which can be either
"pending", "cancelled", or "done". Another is its result, which is set when the state transitions to done. Unlike a corouti... | to the idea of something still to come or not yet happened, and the object is a way to keep an eye on that something.
A future has a few important attributes. One is its state, which can be either
"pending", "cancelled", or "done". Another is its result, which is set when the state transitions to done. Unlike a corouti... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
61af4ac0-0543-4436-ade6-23ee661fcad7 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,082 | supabase-export-v2 | 50d5e47648e419ed | lowly, simple printer, though I have all I " "need in life -- \nfresh paper and my dearly beloved octopus " "partner in crime." )
Calling a regular function invokes its logic or body:: | trusted_official_docs | CPython Docs | lowly, simple printer, though I have all I " "need in life -- \nfresh paper and my dearly beloved octopus " "partner in crime." )
Calling a regular function invokes its logic or body:: | lowly, simple printer, though I have all I " "need in life -- \nfresh paper and my dearly beloved octopus " "partner in crime." )
Calling a regular function invokes its logic or body:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6511ccfc-9f8c-4694-b741-df2b1f9184fd | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,099 | supabase-export-v2 | e7cd03c35738b023 | to an event loop. A task also maintains a list of callback functions whose importance will become clear in a moment when we discuss :keyword:`await`.
Creating a task automatically schedules it for execution (by adding a
callback to run it in the event loop's to-do list, that is, collection of jobs). The recommended way... | trusted_official_docs | CPython Docs | to an event loop. A task also maintains a list of callback functions whose importance will become clear in a moment when we discuss :keyword:`await`.
Creating a task automatically schedules it for execution (by adding a
callback to run it in the event loop's to-do list, that is, collection of jobs). The recommended way... | to an event loop. A task also maintains a list of callback functions whose importance will become clear in a moment when we discuss :keyword:`await`.
Creating a task automatically schedules it for execution (by adding a
callback to run it in the event loop's to-do list, that is, collection of jobs). The recommended way... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
67d65653-593d-469a-881a-db71eeecd608 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,103 | supabase-export-v2 | 857aec01659d349c | coroutine = loudmouth_penguin(magic_number=5) # This creates a Task object and schedules its execution via the event loop. task = asyncio.create_task(coroutine)
Earlier, we manually created the event loop and set it to run forever. In practice, it's recommended to use (and common to see) :func:`asyncio.run`,
which take... | trusted_official_docs | CPython Docs | coroutine = loudmouth_penguin(magic_number=5) # This creates a Task object and schedules its execution via the event loop. task = asyncio.create_task(coroutine)
Earlier, we manually created the event loop and set it to run forever. In practice, it's recommended to use (and common to see) :func:`asyncio.run`,
which take... | coroutine = loudmouth_penguin(magic_number=5) # This creates a Task object and schedules its execution via the event loop. task = asyncio.create_task(coroutine)
Earlier, we manually created the event loop and set it to run forever. In practice, it's recommended to use (and common to see) :func:`asyncio.run`,
which take... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6962c945-d754-47a6-b580-1047439c0850 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,121 | supabase-export-v2 | 7f99fe5cecc29b1f | # Other instructions associated with planting a tree. ...
In this example, imagine the event loop has passed control to the start of the
coroutine ``plant_a_tree()``. As seen above, the coroutine creates a task and then awaits it. The ``await dig_the_hole_task`` instruction adds a callback (which will resume
``plant_a_... | trusted_official_docs | CPython Docs | # Other instructions associated with planting a tree. ...
In this example, imagine the event loop has passed control to the start of the
coroutine ``plant_a_tree()``. As seen above, the coroutine creates a task and then awaits it. The ``await dig_the_hole_task`` instruction adds a callback (which will resume
``plant_a_... | # Other instructions associated with planting a tree. ...
In this example, imagine the event loop has passed control to the start of the
coroutine ``plant_a_tree()``. As seen above, the coroutine creates a task and then awaits it. The ``await dig_the_hole_task`` instruction adds a callback (which will resume
``plant_a_... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
69a3eb69-111a-418a-9c1d-b57049035e4e | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,098 | supabase-export-v2 | 3dc9e063752f20b8 | ===== Tasks =====
Roughly speaking, :ref:`tasks <asyncio-task-obj>` are coroutines (not coroutine
functions) tied to an event loop. A task also maintains a list of callback functions whose importance will become
clear in a moment when we discuss :keyword:`await`. | trusted_official_docs | CPython Docs | ===== Tasks =====
Roughly speaking, :ref:`tasks <asyncio-task-obj>` are coroutines (not coroutine
functions) tied to an event loop. A task also maintains a list of callback functions whose importance will become
clear in a moment when we discuss :keyword:`await`. | ===== Tasks =====
Roughly speaking, :ref:`tasks <asyncio-task-obj>` are coroutines (not coroutine
functions) tied to an event loop. A task also maintains a list of callback functions whose importance will become
clear in a moment when we discuss :keyword:`await`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6a3cc29b-19f8-4e6c-bc8e-c7dde79ef35c | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,155 | supabase-export-v2 | e353b77fd24177f9 | the various ways that control flow and values were passed. A lot of important ideas were covered and it's worth ensuring your understanding is firm.
The only way to yield (or effectively cede control) from a coroutine is to
``await`` an object that ``yield``\ s in its ``__await__`` method. That might sound odd to you. ... | trusted_official_docs | CPython Docs | the various ways that control flow and values were passed. A lot of important ideas were covered and it's worth ensuring your understanding is firm.
The only way to yield (or effectively cede control) from a coroutine is to
``await`` an object that ``yield``\ s in its ``__await__`` method. That might sound odd to you. ... | the various ways that control flow and values were passed. A lot of important ideas were covered and it's worth ensuring your understanding is firm.
The only way to yield (or effectively cede control) from a coroutine is to
``await`` an object that ``yield``\ s in its ``__await__`` method. That might sound odd to you. ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6b23d34a-4dc1-4968-a8b3-fd816c5492da | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,122 | supabase-export-v2 | 72b7c17af77757cc | needs to do. Once the task finishes, it will add its various callbacks to the event loop, in this case, a call to resume ``plant_a_tree()``.
Generally speaking, when the awaited task finishes (``dig_the_hole_task``),
the original task or coroutine (``plant_a_tree()``) is added back to the event
loop's to-do list to be ... | trusted_official_docs | CPython Docs | needs to do. Once the task finishes, it will add its various callbacks to the event loop, in this case, a call to resume ``plant_a_tree()``.
Generally speaking, when the awaited task finishes (``dig_the_hole_task``),
the original task or coroutine (``plant_a_tree()``) is added back to the event
loop's to-do list to be ... | needs to do. Once the task finishes, it will add its various callbacks to the event loop, in this case, a call to resume ``plant_a_tree()``.
Generally speaking, when the awaited task finishes (``dig_the_hole_task``),
the original task or coroutine (``plant_a_tree()``) is added back to the event
loop's to-do list to be ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
72334edd-50f0-4793-be77-474da02831c3 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,157 | supabase-export-v2 | f74861b5aa6fec11 | 1. What about a ``yield`` directly within the coroutine function? The coroutine function becomes an :ref:`async generator function <asynchronous-generator-functions>`, a different beast entirely.
2. What about a :ref:`yield from <yieldexpr>` within the coroutine function to a (plain)
generator? That causes the error: ... | trusted_official_docs | CPython Docs | 1. What about a ``yield`` directly within the coroutine function? The coroutine function becomes an :ref:`async generator function <asynchronous-generator-functions>`, a different beast entirely.
2. What about a :ref:`yield from <yieldexpr>` within the coroutine function to a (plain)
generator? That causes the error: ... | 1. What about a ``yield`` directly within the coroutine function? The coroutine function becomes an :ref:`async generator function <asynchronous-generator-functions>`, a different beast entirely.
2. What about a :ref:`yield from <yieldexpr>` within the coroutine function to a (plain)
generator? That causes the error: ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7970433d-c336-40bd-923c-1297cc3c7987 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,112 | supabase-export-v2 | 4ecc9b82c87a68df | asyncio.run(main())
Because there's no reference to the task object created on line 5, it *might*
be garbage collected before the event loop invokes it. Later instructions in the coroutine ``main()`` hand control back to the event
loop so it can invoke other jobs. When the event loop eventually tries to run the task, i... | trusted_official_docs | CPython Docs | asyncio.run(main())
Because there's no reference to the task object created on line 5, it *might*
be garbage collected before the event loop invokes it. Later instructions in the coroutine ``main()`` hand control back to the event
loop so it can invoke other jobs. When the event loop eventually tries to run the task, i... | asyncio.run(main())
Because there's no reference to the task object created on line 5, it *might*
be garbage collected before the event loop invokes it. Later instructions in the coroutine ``main()`` hand control back to the event
loop so it can invoke other jobs. When the event loop eventually tries to run the task, i... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7bafe82e-ddd9-4d03-ad63-c2347b01e467 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,156 | supabase-export-v2 | e32f6dd154c42102 | from a coroutine is to ``await`` an object that ``yield``\ s in its ``__await__`` method. That might sound odd to you. You might be thinking:
1. What about a ``yield`` directly within the coroutine function? The
coroutine function becomes an
:ref:`async generator function <asynchronous-generator-functions>`, a
diffe... | trusted_official_docs | CPython Docs | from a coroutine is to ``await`` an object that ``yield``\ s in its ``__await__`` method. That might sound odd to you. You might be thinking:
1. What about a ``yield`` directly within the coroutine function? The
coroutine function becomes an
:ref:`async generator function <asynchronous-generator-functions>`, a
diffe... | from a coroutine is to ``await`` an object that ``yield``\ s in its ``__await__`` method. That might sound odd to you. You might be thinking:
1. What about a ``yield`` directly within the coroutine function? The
coroutine function becomes an
:ref:`async generator function <asynchronous-generator-functions>`, a
diffe... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7e2dc1fe-e4aa-40b2-9f25-a1379fc2832a | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,074 | supabase-export-v2 | 9af1792147d0436e | is explicitly granted to it, but a lot of its ability to get things done comes from the respect and cooperation of its band members.
In more technical terms, the event loop contains a collection of jobs to be run. Some jobs are added directly by you, and some indirectly by :mod:`!asyncio`. The event loop takes a job fr... | trusted_official_docs | CPython Docs | is explicitly granted to it, but a lot of its ability to get things done comes from the respect and cooperation of its band members.
In more technical terms, the event loop contains a collection of jobs to be run. Some jobs are added directly by you, and some indirectly by :mod:`!asyncio`. The event loop takes a job fr... | is explicitly granted to it, but a lot of its ability to get things done comes from the respect and cooperation of its band members.
In more technical terms, the event loop contains a collection of jobs to be run. Some jobs are added directly by you, and some indirectly by :mod:`!asyncio`. The event loop takes a job fr... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
81da4b47-c238-4c3b-afca-526014e7b28b | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,070 | supabase-export-v2 | 99b68a2a9377313d | member, Łukasz Langa. * `500 Lines or Less: A Web Crawler With asyncio Coroutines <https:// aosabook.org/en/500L/a-web-crawler-with-asyncio-coroutines.html>`_ by A. Jesse Jiryu Davis and Guido van Rossum.
--------------------------------------------
A conceptual overview part 1: the high-level
-------------------------... | trusted_official_docs | CPython Docs | member, Łukasz Langa. * `500 Lines or Less: A Web Crawler With asyncio Coroutines <https:// aosabook.org/en/500L/a-web-crawler-with-asyncio-coroutines.html>`_ by A. Jesse Jiryu Davis and Guido van Rossum.
--------------------------------------------
A conceptual overview part 1: the high-level
-------------------------... | member, Łukasz Langa. * `500 Lines or Less: A Web Crawler With asyncio Coroutines <https:// aosabook.org/en/500L/a-web-crawler-with-asyncio-coroutines.html>`_ by A. Jesse Jiryu Davis and Guido van Rossum.
--------------------------------------------
A conceptual overview part 1: the high-level
-------------------------... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
85278f9a-ee07-4c78-b07e-0336c98a89dc | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,138 | supabase-export-v2 | 6a3b6b25e4da4ed8 | occurrences via the ``debug=True`` flag, which enables :ref:`debug mode <asyncio-debug-mode>`. Among other things, it will log any coroutines that monopolize execution for 100ms or longer.
The design intentionally trades off some conceptual clarity around usage of
``await`` for improved performance. Each time a task is... | trusted_official_docs | CPython Docs | occurrences via the ``debug=True`` flag, which enables :ref:`debug mode <asyncio-debug-mode>`. Among other things, it will log any coroutines that monopolize execution for 100ms or longer.
The design intentionally trades off some conceptual clarity around usage of
``await`` for improved performance. Each time a task is... | occurrences via the ``debug=True`` flag, which enables :ref:`debug mode <asyncio-debug-mode>`. Among other things, it will log any coroutines that monopolize execution for 100ms or longer.
The design intentionally trades off some conceptual clarity around usage of
``await`` for improved performance. Each time a task is... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8b2bc1a6-9b07-4d60-a19a-e2efcfd7682c | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,148 | supabase-export-v2 | 5a40bff40191c780 | coroutine = main() intermediate_result = coroutine.send(None) print(f"Coroutine paused and returned intermediate value: {intermediate_result}.")
print(f"Resuming coroutine and sending in value: 42.")
try:
coroutine.send(42)
except StopIteration as e:
returned_value = e.value
print(f"Coroutine main() finished and p... | trusted_official_docs | CPython Docs | coroutine = main() intermediate_result = coroutine.send(None) print(f"Coroutine paused and returned intermediate value: {intermediate_result}.")
print(f"Resuming coroutine and sending in value: 42.")
try:
coroutine.send(42)
except StopIteration as e:
returned_value = e.value
print(f"Coroutine main() finished and p... | coroutine = main() intermediate_result = coroutine.send(None) print(f"Coroutine paused and returned intermediate value: {intermediate_result}.")
print(f"Resuming coroutine and sending in value: 42.")
try:
coroutine.send(42)
except StopIteration as e:
returned_value = e.value
print(f"Coroutine main() finished and p... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9363c4ae-1114-4ad5-a789-27e51c3a60b0 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,073 | supabase-export-v2 | 3549bda1aa6e330d | ========== Event loop ==========
Everything in :mod:`!asyncio` happens relative to the event loop. It's the star of the show, but prefers to work behind the scenes, managing
and coordinating resources. It's like an orchestra conductor. Some power is explicitly granted to it, but a lot of its ability to get things
done ... | trusted_official_docs | CPython Docs | ========== Event loop ==========
Everything in :mod:`!asyncio` happens relative to the event loop. It's the star of the show, but prefers to work behind the scenes, managing
and coordinating resources. It's like an orchestra conductor. Some power is explicitly granted to it, but a lot of its ability to get things
done ... | ========== Event loop ==========
Everything in :mod:`!asyncio` happens relative to the event loop. It's the star of the show, but prefers to work behind the scenes, managing
and coordinating resources. It's like an orchestra conductor. Some power is explicitly granted to it, but a lot of its ability to get things
done ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
994c1172-4831-4dbd-9742-e0beff181522 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,172 | supabase-export-v2 | 12c13e1dc57b907d | + seconds # Add the watcher-task to the event loop. watcher_task = asyncio.create_task(_sleep_watcher(future, time_to_wake)) # Block until the future is marked as done. await future
Below, we use a rather bare ``YieldToEventLoop()`` object to ``yield``
from its ``__await__`` method, ceding control to the event loop. Th... | trusted_official_docs | CPython Docs | + seconds # Add the watcher-task to the event loop. watcher_task = asyncio.create_task(_sleep_watcher(future, time_to_wake)) # Block until the future is marked as done. await future
Below, we use a rather bare ``YieldToEventLoop()`` object to ``yield``
from its ``__await__`` method, ceding control to the event loop. Th... | + seconds # Add the watcher-task to the event loop. watcher_task = asyncio.create_task(_sleep_watcher(future, time_to_wake)) # Block until the future is marked as done. await future
Below, we use a rather bare ``YieldToEventLoop()`` object to ``yield``
from its ``__await__`` method, ceding control to the event loop. Th... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9f0f23a5-1b53-4c25-a3b6-008bee5725b4 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,092 | supabase-export-v2 | f7355309fa2dcbc5 | built by leveraging the functionality of :term:`generators <generator iterator>` and :term:`generator functions <generator>`. Recall, a generator function is a function that :keyword:`yield`\s, like this one::
def get_random_number():
# This would be a bad random number generator! print("Hi")
yield 1
print("Hello")
... | trusted_official_docs | CPython Docs | built by leveraging the functionality of :term:`generators <generator iterator>` and :term:`generator functions <generator>`. Recall, a generator function is a function that :keyword:`yield`\s, like this one::
def get_random_number():
# This would be a bad random number generator! print("Hi")
yield 1
print("Hello")
... | built by leveraging the functionality of :term:`generators <generator iterator>` and :term:`generator functions <generator>`. Recall, a generator function is a function that :keyword:`yield`\s, like this one::
def get_random_number():
# This would be a bad random number generator! print("Hi")
yield 1
print("Hello")
... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9fab0254-eb24-490e-9749-693529dff9bd | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,146 | supabase-export-v2 | b235fbb92e6e715c | class Rock: def __await__(self): value_sent_in = yield 7 print(f"Rock.__await__ resuming with value: {value_sent_in}.") return value_sent_in
async def main():
print("Beginning coroutine main().")
rock = Rock()
print("Awaiting rock...")
value_from_rock = await rock
print(f"Coroutine received value: {value_from_rock... | trusted_official_docs | CPython Docs | class Rock: def __await__(self): value_sent_in = yield 7 print(f"Rock.__await__ resuming with value: {value_sent_in}.") return value_sent_in
async def main():
print("Beginning coroutine main().")
rock = Rock()
print("Awaiting rock...")
value_from_rock = await rock
print(f"Coroutine received value: {value_from_rock... | class Rock: def __await__(self): value_sent_in = yield 7 print(f"Rock.__await__ resuming with value: {value_sent_in}.") return value_sent_in
async def main():
print("Beginning coroutine main().")
rock = Rock()
print("Awaiting rock...")
value_from_rock = await rock
print(f"Coroutine received value: {value_from_rock... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a55a6390-0897-4180-b3a9-88422f1076df | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,134 | supabase-export-v2 | fe99c073846b2029 | I am coro_a(). Hi! I am coro_a(). Hi! I am coro_a(). Hi! I am coro_b(). I sure hope no one hogs the event loop...
If we change ``await coro_a()`` to ``await asyncio.create_task(coro_a())``, the
behavior changes. The coroutine ``main()`` cedes control to the event loop with that statement. The event loop then proceeds t... | trusted_official_docs | CPython Docs | I am coro_a(). Hi! I am coro_a(). Hi! I am coro_a(). Hi! I am coro_b(). I sure hope no one hogs the event loop...
If we change ``await coro_a()`` to ``await asyncio.create_task(coro_a())``, the
behavior changes. The coroutine ``main()`` cedes control to the event loop with that statement. The event loop then proceeds t... | I am coro_a(). Hi! I am coro_a(). Hi! I am coro_a(). Hi! I am coro_b(). I sure hope no one hogs the event loop...
If we change ``await coro_a()`` to ``await asyncio.create_task(coro_a())``, the
behavior changes. The coroutine ``main()`` cedes control to the event loop with that statement. The event loop then proceeds t... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a59396d8-1bc8-4a7b-be28-64b10602026f | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,141 | supabase-export-v2 | c3b200ef45bd188b | where the magic happens. You'll come away from this section knowing what ``await`` does behind the scenes and how to make your own asynchronous operators.
================================
The inner workings of coroutines
================================ | trusted_official_docs | CPython Docs | where the magic happens. You'll come away from this section knowing what ``await`` does behind the scenes and how to make your own asynchronous operators.
================================
The inner workings of coroutines
================================ | where the magic happens. You'll come away from this section knowing what ``await`` does behind the scenes and how to make your own asynchronous operators.
================================
The inner workings of coroutines
================================ | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a87d9d1c-1e61-4dec-942f-2d99f273208c | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,163 | supabase-export-v2 | afe067bf316d5b29 | marked as done when you say so. In this way, they're the flexible interface for you to make your own conditions for waiting and resuming.
========================
A homemade asyncio.sleep
======================== | trusted_official_docs | CPython Docs | marked as done when you say so. In this way, they're the flexible interface for you to make your own conditions for waiting and resuming.
========================
A homemade asyncio.sleep
======================== | marked as done when you say so. In this way, they're the flexible interface for you to make your own conditions for waiting and resuming.
========================
A homemade asyncio.sleep
======================== | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ad6c76d0-8d4b-48d4-b749-8138f5446cb8 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,169 | supabase-export-v2 | 107380131c094ee0 | " f"{datetime.datetime.now().strftime("%H:%M:%S")}." ) await asyncio.create_task(async_sleep(3)) print( "Done asynchronous sleep at time: " f"{datetime.datetime.now().strftime("%H:%M:%S")}." ) # asyncio.gather effectively awaits each task in the collection. await asyncio.gather(*work_tasks)
Below, we use a future to en... | trusted_official_docs | CPython Docs | " f"{datetime.datetime.now().strftime("%H:%M:%S")}." ) await asyncio.create_task(async_sleep(3)) print( "Done asynchronous sleep at time: " f"{datetime.datetime.now().strftime("%H:%M:%S")}." ) # asyncio.gather effectively awaits each task in the collection. await asyncio.gather(*work_tasks)
Below, we use a future to en... | " f"{datetime.datetime.now().strftime("%H:%M:%S")}." ) await asyncio.create_task(async_sleep(3)) print( "Done asynchronous sleep at time: " f"{datetime.datetime.now().strftime("%H:%M:%S")}." ) # asyncio.gather effectively awaits each task in the collection. await asyncio.gather(*work_tasks)
Below, we use a future to en... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
af82db9a-b7b5-492d-bded-9c135caac609 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,087 | supabase-export-v2 | b6189f45fc17bebb | loudmouth_penguin(magic_number: int): print( "I am a super special talking penguin. Far cooler than that printer. " f"By the way, my lucky number is: {magic_number}." )
Calling the async function, ``loudmouth_penguin``, does not execute the print statement;
instead, it creates a coroutine object:: | trusted_official_docs | CPython Docs | loudmouth_penguin(magic_number: int): print( "I am a super special talking penguin. Far cooler than that printer. " f"By the way, my lucky number is: {magic_number}." )
Calling the async function, ``loudmouth_penguin``, does not execute the print statement;
instead, it creates a coroutine object:: | loudmouth_penguin(magic_number: int): print( "I am a super special talking penguin. Far cooler than that printer. " f"By the way, my lucky number is: {magic_number}." )
Calling the async function, ``loudmouth_penguin``, does not execute the print statement;
instead, it creates a coroutine object:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b1fd55fa-1ae4-4466-a488-f6fe9c06e504 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,095 | supabase-export-v2 | 3bbdfc7f46766ff3 | >>> get_random_number() <generator object get_random_number at 0x1048671c0>
You can proceed to the next ``yield`` of a generator by using the
built-in function :func:`next`. In other words, the generator runs, then pauses. For example:: | trusted_official_docs | CPython Docs | >>> get_random_number() <generator object get_random_number at 0x1048671c0>
You can proceed to the next ``yield`` of a generator by using the
built-in function :func:`next`. In other words, the generator runs, then pauses. For example:: | >>> get_random_number() <generator object get_random_number at 0x1048671c0>
You can proceed to the next ``yield`` of a generator by using the
built-in function :func:`next`. In other words, the generator runs, then pauses. For example:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b52f2f2b-899a-4831-af0b-55e672cd9af2 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,143 | supabase-export-v2 | 79b4fb488b690d1a | :mod:`!asyncio` leverages four components of Python to pass around control.
:meth:`coroutine.send(arg) <generator.send>` is the method used to start or
resume a coroutine. If the coroutine was paused and is now being resumed, the argument ``arg``
will be sent in as the return value of the ``yield`` statement which orig... | trusted_official_docs | CPython Docs | :mod:`!asyncio` leverages four components of Python to pass around control.
:meth:`coroutine.send(arg) <generator.send>` is the method used to start or
resume a coroutine. If the coroutine was paused and is now being resumed, the argument ``arg``
will be sent in as the return value of the ``yield`` statement which orig... | :mod:`!asyncio` leverages four components of Python to pass around control.
:meth:`coroutine.send(arg) <generator.send>` is the method used to start or
resume a coroutine. If the coroutine was paused and is now being resumed, the argument ``arg``
will be sent in as the return value of the ``yield`` statement which orig... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bcf9a651-9fb1-4314-ad7e-8f5b10993ce1 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,147 | supabase-export-v2 | 96eb02d4dcad2596 | async def main(): print("Beginning coroutine main().") rock = Rock() print("Awaiting rock...") value_from_rock = await rock print(f"Coroutine received value: {value_from_rock} from rock.") return 23
coroutine = main()
intermediate_result = coroutine.send(None)
print(f"Coroutine paused and returned intermediate value:... | trusted_official_docs | CPython Docs | async def main(): print("Beginning coroutine main().") rock = Rock() print("Awaiting rock...") value_from_rock = await rock print(f"Coroutine received value: {value_from_rock} from rock.") return 23
coroutine = main()
intermediate_result = coroutine.send(None)
print(f"Coroutine paused and returned intermediate value:... | async def main(): print("Beginning coroutine main().") rock = Rock() print("Awaiting rock...") value_from_rock = await rock print(f"Coroutine received value: {value_from_rock} from rock.") return 23
coroutine = main()
intermediate_result = coroutine.send(None)
print(f"Coroutine paused and returned intermediate value:... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bd3c47b6-f933-4dc6-b839-ba964f26f0d7 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,119 | supabase-export-v2 | 7e5df7d616f28e6d | or coroutine to the event loop. In the process of relinquishing control, a few important things happen. We'll use the following code example to illustrate::
async def plant_a_tree():
dig_the_hole_task = asyncio.create_task(dig_the_hole())
await dig_the_hole_task | trusted_official_docs | CPython Docs | or coroutine to the event loop. In the process of relinquishing control, a few important things happen. We'll use the following code example to illustrate::
async def plant_a_tree():
dig_the_hole_task = asyncio.create_task(dig_the_hole())
await dig_the_hole_task | or coroutine to the event loop. In the process of relinquishing control, a few important things happen. We'll use the following code example to illustrate::
async def plant_a_tree():
dig_the_hole_task = asyncio.create_task(dig_the_hole())
await dig_the_hole_task | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c159d42e-27a2-4756-a0fe-6aed3e428d04 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,154 | supabase-export-v2 | fd2f293349ed5da5 | Resuming coroutine and sending in value: 42. Rock.__await__ resuming with value: 42. Coroutine received value: 42 from rock. Coroutine main() finished and provided value: 23.
It's worth pausing for a moment here and making sure you followed the various
ways that control flow and values were passed. A lot of important i... | trusted_official_docs | CPython Docs | Resuming coroutine and sending in value: 42. Rock.__await__ resuming with value: 42. Coroutine received value: 42 from rock. Coroutine main() finished and provided value: 23.
It's worth pausing for a moment here and making sure you followed the various
ways that control flow and values were passed. A lot of important i... | Resuming coroutine and sending in value: 42. Rock.__await__ resuming with value: 42. Coroutine received value: 42 from rock. Coroutine main() finished and provided value: 23.
It's worth pausing for a moment here and making sure you followed the various
ways that control flow and values were passed. A lot of important i... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c453b0b3-3c0c-4f1f-aa21-a41d5230c750 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,100 | supabase-export-v2 | 1d5071db30da2790 | a callback to run it in the event loop's to-do list, that is, collection of jobs). The recommended way to create tasks is via :func:`asyncio.create_task`.
:mod:`!asyncio` automatically associates tasks with the event loop for you. This automatic association was purposely designed into :mod:`!asyncio` for
the sake of si... | trusted_official_docs | CPython Docs | a callback to run it in the event loop's to-do list, that is, collection of jobs). The recommended way to create tasks is via :func:`asyncio.create_task`.
:mod:`!asyncio` automatically associates tasks with the event loop for you. This automatic association was purposely designed into :mod:`!asyncio` for
the sake of si... | a callback to run it in the event loop's to-do list, that is, collection of jobs). The recommended way to create tasks is via :func:`asyncio.create_task`.
:mod:`!asyncio` automatically associates tasks with the event loop for you. This automatic association was purposely designed into :mod:`!asyncio` for
the sake of si... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c52d3a1e-87a1-48fe-986b-04f15e61c11b | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,067 | supabase-export-v2 | 3dda4c33e9eea41e | You might be curious about some key :mod:`!asyncio` concepts. By the end of this article, you'll be able to comfortably answer these questions:
- What's happening behind the scenes when an object is awaited? - How does :mod:`!asyncio` differentiate between a task which doesn't need
CPU time (such as a network request ... | trusted_official_docs | CPython Docs | You might be curious about some key :mod:`!asyncio` concepts. By the end of this article, you'll be able to comfortably answer these questions:
- What's happening behind the scenes when an object is awaited? - How does :mod:`!asyncio` differentiate between a task which doesn't need
CPU time (such as a network request ... | You might be curious about some key :mod:`!asyncio` concepts. By the end of this article, you'll be able to comfortably answer these questions:
- What's happening behind the scenes when an object is awaited? - How does :mod:`!asyncio` differentiate between a task which doesn't need
CPU time (such as a network request ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c77dd09e-8006-4687-989c-5cc3d361e3ca | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,125 | supabase-export-v2 | ed994113d60fbf0e | ^^^^^^^^^^^^^^^^^^^ Awaiting coroutines ^^^^^^^^^^^^^^^^^^^
**Unlike tasks, awaiting a coroutine does not hand control back to the event
loop!**
Wrapping a coroutine in a task first, then awaiting that would cede
control. The behavior of ``await coroutine`` is effectively the same as invoking a
regular, synchronous Pyt... | trusted_official_docs | CPython Docs | ^^^^^^^^^^^^^^^^^^^ Awaiting coroutines ^^^^^^^^^^^^^^^^^^^
**Unlike tasks, awaiting a coroutine does not hand control back to the event
loop!**
Wrapping a coroutine in a task first, then awaiting that would cede
control. The behavior of ``await coroutine`` is effectively the same as invoking a
regular, synchronous Pyt... | ^^^^^^^^^^^^^^^^^^^ Awaiting coroutines ^^^^^^^^^^^^^^^^^^^
**Unlike tasks, awaiting a coroutine does not hand control back to the event
loop!**
Wrapping a coroutine in a task first, then awaiting that would cede
control. The behavior of ``await coroutine`` is effectively the same as invoking a
regular, synchronous Pyt... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
da5d41ca-bae7-4ad0-8ef5-63f87e8bda53 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,161 | supabase-export-v2 | eab15c62ae81802c | to be done; instead, it represents the status and result of that computation, kind of like a status light (red, yellow, or green) or indicator.
:class:`asyncio.Task` subclasses :class:`asyncio.Future` in order to gain
these various capabilities. The prior section said tasks store a list of callbacks, which wasn't entir... | trusted_official_docs | CPython Docs | to be done; instead, it represents the status and result of that computation, kind of like a status light (red, yellow, or green) or indicator.
:class:`asyncio.Task` subclasses :class:`asyncio.Future` in order to gain
these various capabilities. The prior section said tasks store a list of callbacks, which wasn't entir... | to be done; instead, it represents the status and result of that computation, kind of like a status light (red, yellow, or green) or indicator.
:class:`asyncio.Task` subclasses :class:`asyncio.Future` in order to gain
these various capabilities. The prior section said tasks store a list of callbacks, which wasn't entir... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dbe3c3d9-81a8-428f-9175-963d3c393aef | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,093 | supabase-export-v2 | d2ff1df07df3c32c | def get_random_number(): # This would be a bad random number generator! print("Hi") yield 1 print("Hello") yield 7 print("Howdy") yield 4 ...
Similar to a coroutine function, calling a generator function does not run it. Instead, it creates a generator object:: | trusted_official_docs | CPython Docs | def get_random_number(): # This would be a bad random number generator! print("Hi") yield 1 print("Hello") yield 7 print("Howdy") yield 4 ...
Similar to a coroutine function, calling a generator function does not run it. Instead, it creates a generator object:: | def get_random_number(): # This would be a bad random number generator! print("Hi") yield 1 print("Hello") yield 7 print("Howdy") yield 4 ...
Similar to a coroutine function, calling a generator function does not run it. Instead, it creates a generator object:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e5b221ad-dc5c-46fd-b0a9-39af248f82bb | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,089 | supabase-export-v2 | fc7bfce4735c86d9 | >>> loudmouth_penguin(magic_number=3) <coroutine object loudmouth_penguin at 0x104ed2740>
The terms "coroutine function" and "coroutine object" are often conflated
as coroutine. That can be confusing! In this article, coroutine specifically refers to a coroutine object, or more
precisely, an instance of :data:`types.Co... | trusted_official_docs | CPython Docs | >>> loudmouth_penguin(magic_number=3) <coroutine object loudmouth_penguin at 0x104ed2740>
The terms "coroutine function" and "coroutine object" are often conflated
as coroutine. That can be confusing! In this article, coroutine specifically refers to a coroutine object, or more
precisely, an instance of :data:`types.Co... | >>> loudmouth_penguin(magic_number=3) <coroutine object loudmouth_penguin at 0x104ed2740>
The terms "coroutine function" and "coroutine object" are often conflated
as coroutine. That can be confusing! In this article, coroutine specifically refers to a coroutine object, or more
precisely, an instance of :data:`types.Co... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ead28a18-87e4-4ced-accd-ae031459c517 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,075 | supabase-export-v2 | 2944e3d784b519ca | added and then processed one at a time, generally (but not always) in order. This process repeats indefinitely, with the event loop cycling endlessly onwards.
If there are no more jobs pending execution, the event loop is smart enough to
rest and avoid needlessly wasting CPU cycles, and will come back when there's
more... | trusted_official_docs | CPython Docs | added and then processed one at a time, generally (but not always) in order. This process repeats indefinitely, with the event loop cycling endlessly onwards.
If there are no more jobs pending execution, the event loop is smart enough to
rest and avoid needlessly wasting CPU cycles, and will come back when there's
more... | added and then processed one at a time, generally (but not always) in order. This process repeats indefinitely, with the event loop cycling endlessly onwards.
If there are no more jobs pending execution, the event loop is smart enough to
rest and avoid needlessly wasting CPU cycles, and will come back when there's
more... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f0226a48-0d90-4a4f-81e9-4c5bf8cd4e87 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,123 | supabase-export-v2 | 0b9fa7e61a2cce97 | speaking, when the awaited task finishes (``dig_the_hole_task``), the original task or coroutine (``plant_a_tree()``) is added back to the event loop's to-do list to be resumed.
This is a basic, yet reliable mental model. In practice, the control handoffs are slightly more complex, but not by much. In part 2, we'll wal... | trusted_official_docs | CPython Docs | speaking, when the awaited task finishes (``dig_the_hole_task``), the original task or coroutine (``plant_a_tree()``) is added back to the event loop's to-do list to be resumed.
This is a basic, yet reliable mental model. In practice, the control handoffs are slightly more complex, but not by much. In part 2, we'll wal... | speaking, when the awaited task finishes (``dig_the_hole_task``), the original task or coroutine (``plant_a_tree()``) is added back to the event loop's to-do list to be resumed.
This is a basic, yet reliable mental model. In practice, the control handoffs are slightly more complex, but not by much. In part 2, we'll wal... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f1cd0a5e-55a1-4bc2-8ba0-36f20278c77b | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,131 | supabase-export-v2 | db13f5b8af3cfb8c | asyncio.run(main())
The first statement in the coroutine ``main()`` creates ``task_b`` and schedules
it for execution via the event loop. Then, ``coro_a()`` is repeatedly awaited. Control never cedes to the
event loop, which is why we see the output of all three ``coro_a()``
invocations before ``coro_b()``'s output: | trusted_official_docs | CPython Docs | asyncio.run(main())
The first statement in the coroutine ``main()`` creates ``task_b`` and schedules
it for execution via the event loop. Then, ``coro_a()`` is repeatedly awaited. Control never cedes to the
event loop, which is why we see the output of all three ``coro_a()``
invocations before ``coro_b()``'s output: | asyncio.run(main())
The first statement in the coroutine ``main()`` creates ``task_b`` and schedules
it for execution via the event loop. Then, ``coro_a()`` is repeatedly awaited. Control never cedes to the
event loop, which is why we see the output of all three ``coro_a()``
invocations before ``coro_b()``'s output: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f2af3fbc-1a63-4cfd-a203-c81b4990fdae | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,069 | supabase-export-v2 | f3e830b368c90f15 | .. seealso::
* The `guide <https://github.com/anordin95/a-conceptual-overview-of-asyncio/
tree/main>`_ that inspired this HOWTO article, by Alexander Nordin. * This in-depth `YouTube tutorial series <https://www.youtube.com/
watch?v=Xbl7XjFYsN4&list=PLhNSoGM2ik6SIkVGXWBwerucXjgP1rHmB>`_ on
``asyncio`` created by Pyt... | trusted_official_docs | CPython Docs | .. seealso::
* The `guide <https://github.com/anordin95/a-conceptual-overview-of-asyncio/
tree/main>`_ that inspired this HOWTO article, by Alexander Nordin. * This in-depth `YouTube tutorial series <https://www.youtube.com/
watch?v=Xbl7XjFYsN4&list=PLhNSoGM2ik6SIkVGXWBwerucXjgP1rHmB>`_ on
``asyncio`` created by Pyt... | .. seealso::
* The `guide <https://github.com/anordin95/a-conceptual-overview-of-asyncio/
tree/main>`_ that inspired this HOWTO article, by Alexander Nordin. * This in-depth `YouTube tutorial series <https://www.youtube.com/
watch?v=Xbl7XjFYsN4&list=PLhNSoGM2ik6SIkVGXWBwerucXjgP1rHmB>`_ on
``asyncio`` created by Pyt... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f3651861-a58b-43cd-9fe2-867faf1a38f1 | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,091 | supabase-export-v2 | 47ff0ba8374608f3 | the coroutine can be paused and resumed at various points within the function's body. That pausing and resuming ability is what allows for asynchronous behavior!
Coroutines and coroutine functions were built by leveraging the functionality
of :term:`generators <generator iterator>` and
:term:`generator functions <gener... | trusted_official_docs | CPython Docs | the coroutine can be paused and resumed at various points within the function's body. That pausing and resuming ability is what allows for asynchronous behavior!
Coroutines and coroutine functions were built by leveraging the functionality
of :term:`generators <generator iterator>` and
:term:`generator functions <gener... | the coroutine can be paused and resumed at various points within the function's body. That pausing and resuming ability is what allows for asynchronous behavior!
Coroutines and coroutine functions were built by leveraging the functionality
of :term:`generators <generator iterator>` and
:term:`generator functions <gener... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f801f16f-bc1b-46b7-a3b8-73fe468be0fe | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,168 | supabase-export-v2 | f16727e2435db709 | async def other_work(): print("I like work. Work work.")
async def main():
# Add a few other tasks to the event loop, so there's something
# to do while asynchronously sleeping. work_tasks = [
asyncio.create_task(other_work()),
asyncio.create_task(other_work()),
asyncio.create_task(other_work())
]
print(
"Begin... | trusted_official_docs | CPython Docs | async def other_work(): print("I like work. Work work.")
async def main():
# Add a few other tasks to the event loop, so there's something
# to do while asynchronously sleeping. work_tasks = [
asyncio.create_task(other_work()),
asyncio.create_task(other_work()),
asyncio.create_task(other_work())
]
print(
"Begin... | async def other_work(): print("I like work. Work work.")
async def main():
# Add a few other tasks to the event loop, so there's something
# to do while asynchronously sleeping. work_tasks = [
asyncio.create_task(other_work()),
asyncio.create_task(other_work()),
asyncio.create_task(other_work())
]
print(
"Begin... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fc4a44ce-d8d0-449a-8506-92eb4665707b | CPython Docs | file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst | unknown | f03d6bf2-0a07-40e4-bbd5-fe293623640c | 60,149 | supabase-export-v2 | d13e1b35106e98a6 | print(f"Resuming coroutine and sending in value: 42.") try: coroutine.send(42) except StopIteration as e: returned_value = e.value print(f"Coroutine main() finished and provided value: {returned_value}.")
:ref:`yield <yieldexpr>`, as usual, pauses execution and returns control
to the caller. In the example above, the `... | trusted_official_docs | CPython Docs | print(f"Resuming coroutine and sending in value: 42.") try: coroutine.send(42) except StopIteration as e: returned_value = e.value print(f"Coroutine main() finished and provided value: {returned_value}.")
:ref:`yield <yieldexpr>`, as usual, pauses execution and returns control
to the caller. In the example above, the `... | print(f"Resuming coroutine and sending in value: 42.") try: coroutine.send(42) except StopIteration as e: returned_value = e.value print(f"Coroutine main() finished and provided value: {returned_value}.")
:ref:`yield <yieldexpr>`, as usual, pauses execution and returns control
to the caller. In the example above, the `... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
05cd9621-7b8f-48f9-93bb-25732aa5de0a | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,247 | supabase-export-v2 | 6ab4c21b92fa2246 | This marker indicates that execution of a Python function has begun. It is only triggered for pure-Python (bytecode) functions.
The filename, function name, and line number are provided back to the
tracing script as positional arguments, which must be accessed using
``$arg1``, ``$arg2``, ``$arg3``: | trusted_official_docs | CPython Docs | This marker indicates that execution of a Python function has begun. It is only triggered for pure-Python (bytecode) functions.
The filename, function name, and line number are provided back to the
tracing script as positional arguments, which must be accessed using
``$arg1``, ``$arg2``, ``$arg3``: | This marker indicates that execution of a Python function has begun. It is only triggered for pure-Python (bytecode) functions.
The filename, function name, and line number are provided back to the
tracing script as positional arguments, which must be accessed using
``$arg1``, ``$arg2``, ``$arg3``: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
100f9b30-f1af-4675-8862-1861e27033ef | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,268 | supabase-export-v2 | 7d2b39417ec0b7b0 | .. object:: audit(str event, void *tuple)
Fires when :func:`sys.audit` or :c:func:`PySys_Audit` is called. ``arg0`` is the event name as C string, ``arg1`` is a :c:type:`PyObject`
pointer to a tuple object. | trusted_official_docs | CPython Docs | .. object:: audit(str event, void *tuple)
Fires when :func:`sys.audit` or :c:func:`PySys_Audit` is called. ``arg0`` is the event name as C string, ``arg1`` is a :c:type:`PyObject`
pointer to a tuple object. | .. object:: audit(str event, void *tuple)
Fires when :func:`sys.audit` or :c:func:`PySys_Audit` is called. ``arg0`` is the event name as C string, ``arg1`` is a :c:type:`PyObject`
pointer to a tuple object. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
108d73f3-e404-485a-86a4-8d3c837258cd | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,248 | supabase-export-v2 | a2d42760f6d4e0cc | The filename, function name, and line number are provided back to the tracing script as positional arguments, which must be accessed using ``$arg1``, ``$arg2``, ``$arg3``:
* ``$arg1`` : ``(const char *)`` filename, accessible using ``user_string($arg1)`` | trusted_official_docs | CPython Docs | The filename, function name, and line number are provided back to the tracing script as positional arguments, which must be accessed using ``$arg1``, ``$arg2``, ``$arg3``:
* ``$arg1`` : ``(const char *)`` filename, accessible using ``user_string($arg1)`` | The filename, function name, and line number are provided back to the tracing script as positional arguments, which must be accessed using ``$arg1``, ``$arg2``, ``$arg3``:
* ``$arg1`` : ``(const char *)`` filename, accessible using ``user_string($arg1)`` | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
12b24f53-7f0a-4bcf-9fee-623788200ec5 | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,297 | supabase-export-v2 | 5ab372000ab9c10d | probe python.function.entry { fn_calls[pid(), filename, funcname, lineno] += 1; }
probe timer.ms(1000) {
printf("\033[2J\033[1;1H") /* clear screen \*/
printf("%6s %80s %6s %30s %6s\n",
"PID", "FILENAME", "LINE", "FUNCTION", "CALLS")
foreach ([pid, filename, funcname, lineno] in fn_calls- limit 20) {
printf("%6d %... | trusted_official_docs | CPython Docs | probe python.function.entry { fn_calls[pid(), filename, funcname, lineno] += 1; }
probe timer.ms(1000) {
printf("\033[2J\033[1;1H") /* clear screen \*/
printf("%6s %80s %6s %30s %6s\n",
"PID", "FILENAME", "LINE", "FUNCTION", "CALLS")
foreach ([pid, filename, funcname, lineno] in fn_calls- limit 20) {
printf("%6d %... | probe python.function.entry { fn_calls[pid(), filename, funcname, lineno] += 1; }
probe timer.ms(1000) {
printf("\033[2J\033[1;1H") /* clear screen \*/
printf("%6s %80s %6s %30s %6s\n",
"PID", "FILENAME", "LINE", "FUNCTION", "CALLS")
foreach ([pid, filename, funcname, lineno] in fn_calls- limit 20) {
printf("%6d %... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1d3c64ec-d19d-4322-9a97-73c02c75ae56 | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,212 | supabase-export-v2 | a53fd76d6c6c5694 | Static DTrace probes --------------------
The following example DTrace script can be used to show the call/return
hierarchy of a Python script, only tracing within the invocation of
a function called "start". In other words, import-time function
invocations are not going to be listed: | trusted_official_docs | CPython Docs | Static DTrace probes --------------------
The following example DTrace script can be used to show the call/return
hierarchy of a Python script, only tracing within the invocation of
a function called "start". In other words, import-time function
invocations are not going to be listed: | Static DTrace probes --------------------
The following example DTrace script can be used to show the call/return
hierarchy of a Python script, only tracing within the invocation of
a function called "start". In other words, import-time function
invocations are not going to be listed: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2d5f2a46-c9bb-49de-8e54-fe3b9d564ce1 | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,189 | supabase-export-v2 | 288c39fa076f65fa | .. impl-detail::
DTrace markers are implementation details of the CPython interpreter. No guarantees are made about probe compatibility between versions of
CPython. DTrace scripts can stop working or work incorrectly without
warning when changing CPython versions. | trusted_official_docs | CPython Docs | .. impl-detail::
DTrace markers are implementation details of the CPython interpreter. No guarantees are made about probe compatibility between versions of
CPython. DTrace scripts can stop working or work incorrectly without
warning when changing CPython versions. | .. impl-detail::
DTrace markers are implementation details of the CPython interpreter. No guarantees are made about probe compatibility between versions of
CPython. DTrace scripts can stop working or work incorrectly without
warning when changing CPython versions. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
307f4890-4e4c-43d3-8eda-ba184412806b | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,282 | supabase-export-v2 | d771346f31de7cb8 | use the SystemTap integration is to use a "tapset": SystemTap's equivalent of a library, which hides some of the lower-level details of the static markers.
Here is a tapset file, based on a non-shared build of CPython: | trusted_official_docs | CPython Docs | use the SystemTap integration is to use a "tapset": SystemTap's equivalent of a library, which hides some of the lower-level details of the static markers.
Here is a tapset file, based on a non-shared build of CPython: | use the SystemTap integration is to use a "tapset": SystemTap's equivalent of a library, which hides some of the lower-level details of the static markers.
Here is a tapset file, based on a non-shared build of CPython: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
337203f6-6527-4d93-87c4-8baff04c9331 | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,255 | supabase-export-v2 | 3e6d883e53107913 | .. object:: line(str filename, str funcname, int lineno)
This marker indicates a Python line is about to be executed. It is
the equivalent of line-by-line tracing with a Python profiler. It is
not triggered within C functions. | trusted_official_docs | CPython Docs | .. object:: line(str filename, str funcname, int lineno)
This marker indicates a Python line is about to be executed. It is
the equivalent of line-by-line tracing with a Python profiler. It is
not triggered within C functions. | .. object:: line(str filename, str funcname, int lineno)
This marker indicates a Python line is about to be executed. It is
the equivalent of line-by-line tracing with a Python profiler. It is
not triggered within C functions. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
35979346-955f-4c36-9e95-b29b9e7a1a24 | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,271 | supabase-export-v2 | f8ac446cfbe53e90 | C Entry Points ^^^^^^^^^^^^^^
To simplify triggering of DTrace markers, Python's C API comes with a number
of helper functions that mirror each static marker. On builds of Python without
DTrace enabled, these do nothing. | trusted_official_docs | CPython Docs | C Entry Points ^^^^^^^^^^^^^^
To simplify triggering of DTrace markers, Python's C API comes with a number
of helper functions that mirror each static marker. On builds of Python without
DTrace enabled, these do nothing. | C Entry Points ^^^^^^^^^^^^^^
To simplify triggering of DTrace markers, Python's C API comes with a number
of helper functions that mirror each static marker. On builds of Python without
DTrace enabled, these do nothing. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
38b00ff0-84ef-4445-9d2e-6f8fd63d8dc1 | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,199 | supabase-export-v2 | c43057ac9222292b | $ python3.6 -q & $ sudo dtrace -l -P python$! # or: dtrace -l -m python3.6
ID PROVIDER MODULE FUNCTION NAME
29564 python18035 python3.6 _PyEval_EvalFrameDefault function-entry
29565 python18035 python3.6 dtrace_function_entry function-entry
29566 python18035 python3.6 _PyEval_EvalFrameDefault function-return
29567 ... | trusted_official_docs | CPython Docs | $ python3.6 -q & $ sudo dtrace -l -P python$! # or: dtrace -l -m python3.6
ID PROVIDER MODULE FUNCTION NAME
29564 python18035 python3.6 _PyEval_EvalFrameDefault function-entry
29565 python18035 python3.6 dtrace_function_entry function-entry
29566 python18035 python3.6 _PyEval_EvalFrameDefault function-return
29567 ... | $ python3.6 -q & $ sudo dtrace -l -P python$! # or: dtrace -l -m python3.6
ID PROVIDER MODULE FUNCTION NAME
29564 python18035 python3.6 _PyEval_EvalFrameDefault function-entry
29565 python18035 python3.6 dtrace_function_entry function-entry
29566 python18035 python3.6 _PyEval_EvalFrameDefault function-return
29567 ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
479e6b13-c54f-4f3e-b9df-1d7740121ede | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,275 | supabase-export-v2 | 58262ed66d1eff96 | .. c:function:: void PyDTrace_GC_DONE(Py_ssize_t arg0) * :c:func:`!gc__done` * * * .. c:function:: void PyDTrace_INSTANCE_NEW_START(int arg0) * :c:func:`!instance__new__start` * Not used by Python * * ..
c:function:: void PyDTrace_INSTANCE_NEW_DONE(int arg0)
* :c:func:`!instance__new__done`
* Not used by Python
* * ... | trusted_official_docs | CPython Docs | .. c:function:: void PyDTrace_GC_DONE(Py_ssize_t arg0) * :c:func:`!gc__done` * * * .. c:function:: void PyDTrace_INSTANCE_NEW_START(int arg0) * :c:func:`!instance__new__start` * Not used by Python * * ..
c:function:: void PyDTrace_INSTANCE_NEW_DONE(int arg0)
* :c:func:`!instance__new__done`
* Not used by Python
* * ... | .. c:function:: void PyDTrace_GC_DONE(Py_ssize_t arg0) * :c:func:`!gc__done` * * * .. c:function:: void PyDTrace_INSTANCE_NEW_START(int arg0) * :c:func:`!instance__new__start` * Not used by Python * * ..
c:function:: void PyDTrace_INSTANCE_NEW_DONE(int arg0)
* :c:func:`!instance__new__done`
* Not used by Python
* * ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4aa66fa5-61ed-449b-b1a2-52f9852afbf5 | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,224 | supabase-export-v2 | 2d1175ae60e17691 | low-level way to use the SystemTap integration is to use the static markers directly. This requires you to explicitly state the binary file containing them.
For example, this SystemTap script can be used to show the call/return
hierarchy of a Python script: | trusted_official_docs | CPython Docs | low-level way to use the SystemTap integration is to use the static markers directly. This requires you to explicitly state the binary file containing them.
For example, this SystemTap script can be used to show the call/return
hierarchy of a Python script: | low-level way to use the SystemTap integration is to use the static markers directly. This requires you to explicitly state the binary file containing them.
For example, this SystemTap script can be used to show the call/return
hierarchy of a Python script: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
51fd90cb-3f3a-4dfc-9635-6c27377e6d89 | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,274 | supabase-export-v2 | 930195e1c7356459 | .. list-table:: :widths: 50 25 25 :header-rows: 1
* * C API Function
* Static Marker
* Notes
* * .. c:function:: void PyDTrace_LINE(const char *arg0, const char *arg1, int arg2)
* :c:func:`!line`
*
* * .. c:function:: void PyDTrace_FUNCTION_ENTRY(const char *arg0, const char *arg1, int arg2)
* :c:func:`!function... | trusted_official_docs | CPython Docs | .. list-table:: :widths: 50 25 25 :header-rows: 1
* * C API Function
* Static Marker
* Notes
* * .. c:function:: void PyDTrace_LINE(const char *arg0, const char *arg1, int arg2)
* :c:func:`!line`
*
* * .. c:function:: void PyDTrace_FUNCTION_ENTRY(const char *arg0, const char *arg1, int arg2)
* :c:func:`!function... | .. list-table:: :widths: 50 25 25 :header-rows: 1
* * C API Function
* Static Marker
* Notes
* * .. c:function:: void PyDTrace_LINE(const char *arg0, const char *arg1, int arg2)
* :c:func:`!line`
*
* * .. c:function:: void PyDTrace_FUNCTION_ENTRY(const char *arg0, const char *arg1, int arg2)
* :c:func:`!function... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5302db7a-1892-4f13-abf1-dd197be560b5 | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,191 | supabase-export-v2 | 6d7496720064e2e6 | Enabling the static markers ---------------------------
macOS comes with built-in support for DTrace. On Linux, in order to
build CPython with the embedded markers for SystemTap, the SystemTap
development tools must be installed. | trusted_official_docs | CPython Docs | Enabling the static markers ---------------------------
macOS comes with built-in support for DTrace. On Linux, in order to
build CPython with the embedded markers for SystemTap, the SystemTap
development tools must be installed. | Enabling the static markers ---------------------------
macOS comes with built-in support for DTrace. On Linux, in order to
build CPython with the embedded markers for SystemTap, the SystemTap
development tools must be installed. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5a984c3a-ebaa-4aea-8d80-2f1b358c5750 | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,210 | supabase-export-v2 | f4043428f4526128 | 0x00000000008d6be8 Arguments: 8@%rbp 8@%r12 -4@%eax stapsdt 0x00000046 NT_STAPSDT (SystemTap probe descriptors) Provider: python Name: function__return Location: 0x000000000053dba8, Base: 0x0000000000630ce2, Semaphore: 0x00000000008d6bea Arguments: 8@%rbp 8@%r12 -4@%eax
The above metadata contains information for Syste... | trusted_official_docs | CPython Docs | 0x00000000008d6be8 Arguments: 8@%rbp 8@%r12 -4@%eax stapsdt 0x00000046 NT_STAPSDT (SystemTap probe descriptors) Provider: python Name: function__return Location: 0x000000000053dba8, Base: 0x0000000000630ce2, Semaphore: 0x00000000008d6bea Arguments: 8@%rbp 8@%r12 -4@%eax
The above metadata contains information for Syste... | 0x00000000008d6be8 Arguments: 8@%rbp 8@%r12 -4@%eax stapsdt 0x00000046 NT_STAPSDT (SystemTap probe descriptors) Provider: python Name: function__return Location: 0x000000000053dba8, Base: 0x0000000000630ce2, Semaphore: 0x00000000008d6bea Arguments: 8@%rbp 8@%r12 -4@%eax
The above metadata contains information for Syste... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6436c9c1-3b41-4080-94d7-219f23269042 | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,197 | supabase-export-v2 | 28cc5a9c3eea9955 | checking for --with-dtrace... yes
On macOS, you can list available DTrace probes by running a Python
process in the background and listing all probes made available by the
Python provider:: | trusted_official_docs | CPython Docs | checking for --with-dtrace... yes
On macOS, you can list available DTrace probes by running a Python
process in the background and listing all probes made available by the
Python provider:: | checking for --with-dtrace... yes
On macOS, you can list available DTrace probes by running a Python
process in the background and listing all probes made available by the
Python provider:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
713fc77c-e110-4cf8-8a6c-d8ac9442ff41 | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,209 | supabase-export-v2 | 2ea1cd1b59c6bdb4 | Displaying notes found at file offset 0x00000274 with length 0x00000024: Owner Data size Description GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring) Build ID: df924a2b08a7e89f6e11251d4602022977af2670
Displaying notes found at file offset 0x002d6c30 with length 0x00000144:
Owner Data size Description
stapsd... | trusted_official_docs | CPython Docs | Displaying notes found at file offset 0x00000274 with length 0x00000024: Owner Data size Description GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring) Build ID: df924a2b08a7e89f6e11251d4602022977af2670
Displaying notes found at file offset 0x002d6c30 with length 0x00000144:
Owner Data size Description
stapsd... | Displaying notes found at file offset 0x00000274 with length 0x00000024: Owner Data size Description GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring) Build ID: df924a2b08a7e89f6e11251d4602022977af2670
Displaying notes found at file offset 0x002d6c30 with length 0x00000144:
Owner Data size Description
stapsd... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
775ad10e-42bb-49e7-bde9-53a2db00f7c1 | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,190 | supabase-export-v2 | c3abb5fd6747e103 | No guarantees are made about probe compatibility between versions of CPython. DTrace scripts can stop working or work incorrectly without warning when changing CPython versions.
Enabling the static markers
--------------------------- | trusted_official_docs | CPython Docs | No guarantees are made about probe compatibility between versions of CPython. DTrace scripts can stop working or work incorrectly without warning when changing CPython versions.
Enabling the static markers
--------------------------- | No guarantees are made about probe compatibility between versions of CPython. DTrace scripts can stop working or work incorrectly without warning when changing CPython versions.
Enabling the static markers
--------------------------- | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7dc03923-4c4a-454c-b0dd-31bb50f6a72c | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,252 | supabase-export-v2 | 8dd97366ae4ab209 | .. object:: function__return(str filename, str funcname, int lineno)
This marker is the converse of :c:func:`!function__entry`, and indicates that
execution of a Python function has ended (either via ``return``, or via an
exception). It is only triggered for pure-Python (bytecode) functions. | trusted_official_docs | CPython Docs | .. object:: function__return(str filename, str funcname, int lineno)
This marker is the converse of :c:func:`!function__entry`, and indicates that
execution of a Python function has ended (either via ``return``, or via an
exception). It is only triggered for pure-Python (bytecode) functions. | .. object:: function__return(str filename, str funcname, int lineno)
This marker is the converse of :c:func:`!function__entry`, and indicates that
execution of a Python function has ended (either via ``return``, or via an
exception). It is only triggered for pure-Python (bytecode) functions. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
826ad9c3-8a83-4ddc-9118-86eed1278693 | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,253 | supabase-export-v2 | e282ada65f13cdd7 | and indicates that execution of a Python function has ended (either via ``return``, or via an exception). It is only triggered for pure-Python (bytecode) functions.
The arguments are the same as for :c:func:`!function__entry` | trusted_official_docs | CPython Docs | and indicates that execution of a Python function has ended (either via ``return``, or via an exception). It is only triggered for pure-Python (bytecode) functions.
The arguments are the same as for :c:func:`!function__entry` | and indicates that execution of a Python function has ended (either via ``return``, or via an exception). It is only triggered for pure-Python (bytecode) functions.
The arguments are the same as for :c:func:`!function__entry` | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8427d17a-ede6-4acf-a185-8340d21afa59 | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,198 | supabase-export-v2 | df85fe7fc385b0b2 | macOS, you can list available DTrace probes by running a Python process in the background and listing all probes made available by the Python provider::
$ python3.6 -q &
$ sudo dtrace -l -P python$! # or: dtrace -l -m python3.6 | trusted_official_docs | CPython Docs | macOS, you can list available DTrace probes by running a Python process in the background and listing all probes made available by the Python provider::
$ python3.6 -q &
$ sudo dtrace -l -P python$! # or: dtrace -l -m python3.6 | macOS, you can list available DTrace probes by running a Python process in the background and listing all probes made available by the Python provider::
$ python3.6 -q &
$ sudo dtrace -l -P python$! # or: dtrace -l -m python3.6 | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
848c1208-d4ef-40cc-97bc-c0bb59e58302 | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,289 | supabase-export-v2 | 705603b9e85f7a25 | .. object:: python.function.return(str filename, str funcname, int lineno, frameptr)
This probe point is the converse of ``python.function.return``, and
indicates that execution of a Python function has ended (either via
``return``, or via an exception). It is only triggered for pure-Python
(bytecode) functions. | trusted_official_docs | CPython Docs | .. object:: python.function.return(str filename, str funcname, int lineno, frameptr)
This probe point is the converse of ``python.function.return``, and
indicates that execution of a Python function has ended (either via
``return``, or via an exception). It is only triggered for pure-Python
(bytecode) functions. | .. object:: python.function.return(str filename, str funcname, int lineno, frameptr)
This probe point is the converse of ``python.function.return``, and
indicates that execution of a Python function has ended (either via
``return``, or via an exception). It is only triggered for pure-Python
(bytecode) functions. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8504fd49-5a85-4a84-9173-aeea2da379e7 | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,279 | supabase-export-v2 | 4d1f3ba5ff501eb7 | to ``PyDTrace`` functions must be guarded by a call to one of these functions. This allows Python to minimize performance impact when probing is disabled.
On builds without DTrace enabled, these functions do nothing and return
``0``. | trusted_official_docs | CPython Docs | to ``PyDTrace`` functions must be guarded by a call to one of these functions. This allows Python to minimize performance impact when probing is disabled.
On builds without DTrace enabled, these functions do nothing and return
``0``. | to ``PyDTrace`` functions must be guarded by a call to one of these functions. This allows Python to minimize performance impact when probing is disabled.
On builds without DTrace enabled, these functions do nothing and return
``0``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
85549ed4-116d-481c-9e44-e2ccd93fc04b | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,277 | supabase-export-v2 | da79a6a631274e12 | C Probing Checks ^^^^^^^^^^^^^^^^
.. c:function:: int PyDTrace_LINE_ENABLED(void)
.. c:function:: int PyDTrace_FUNCTION_ENTRY_ENABLED(void)
.. c:function:: int PyDTrace_FUNCTION_RETURN_ENABLED(void)
.. c:function:: int PyDTrace_GC_START_ENABLED(void)
.. c:function:: int PyDTrace_GC_DONE_ENABLED(void)
.. c:function:: in... | trusted_official_docs | CPython Docs | C Probing Checks ^^^^^^^^^^^^^^^^
.. c:function:: int PyDTrace_LINE_ENABLED(void)
.. c:function:: int PyDTrace_FUNCTION_ENTRY_ENABLED(void)
.. c:function:: int PyDTrace_FUNCTION_RETURN_ENABLED(void)
.. c:function:: int PyDTrace_GC_START_ENABLED(void)
.. c:function:: int PyDTrace_GC_DONE_ENABLED(void)
.. c:function:: in... | C Probing Checks ^^^^^^^^^^^^^^^^
.. c:function:: int PyDTrace_LINE_ENABLED(void)
.. c:function:: int PyDTrace_FUNCTION_ENTRY_ENABLED(void)
.. c:function:: int PyDTrace_FUNCTION_RETURN_ENABLED(void)
.. c:function:: int PyDTrace_GC_START_ENABLED(void)
.. c:function:: int PyDTrace_GC_DONE_ENABLED(void)
.. c:function:: in... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
871d016c-6137-4041-ad61-294b674f91bf | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,256 | supabase-export-v2 | 96e673eb09c4b190 | Python line is about to be executed. It is the equivalent of line-by-line tracing with a Python profiler. It is not triggered within C functions.
The arguments are the same as for :c:func:`!function__entry`. | trusted_official_docs | CPython Docs | Python line is about to be executed. It is the equivalent of line-by-line tracing with a Python profiler. It is not triggered within C functions.
The arguments are the same as for :c:func:`!function__entry`. | Python line is about to be executed. It is the equivalent of line-by-line tracing with a Python profiler. It is not triggered within C functions.
The arguments are the same as for :c:func:`!function__entry`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8b9e77f4-fa5d-43d7-99f0-e267c1c7f470 | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,186 | supabase-export-v2 | d7c38fee1bbd9530 | a way to inspect what the processes on a computer system are doing. They both use domain-specific languages allowing a user to write scripts which:
- filter which processes are to be observed
- gather data from the processes of interest
- generate reports on the data | trusted_official_docs | CPython Docs | a way to inspect what the processes on a computer system are doing. They both use domain-specific languages allowing a user to write scripts which:
- filter which processes are to be observed
- gather data from the processes of interest
- generate reports on the data | a way to inspect what the processes on a computer system are doing. They both use domain-specific languages allowing a user to write scripts which:
- filter which processes are to be observed
- gather data from the processes of interest
- generate reports on the data | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8ba654ce-fe74-4b5d-abb0-6d1bb8c0e58f | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,208 | supabase-export-v2 | 5bf1096e4231ba44 | Displaying notes found at file offset 0x00000254 with length 0x00000020: Owner Data size Description GNU 0x00000010 NT_GNU_ABI_TAG (ABI version tag) OS: Linux, ABI: 2.6.32
Displaying notes found at file offset 0x00000274 with length 0x00000024:
Owner Data size Description
GNU 0x00000014 NT_GNU_BUILD_ID (unique build ... | trusted_official_docs | CPython Docs | Displaying notes found at file offset 0x00000254 with length 0x00000020: Owner Data size Description GNU 0x00000010 NT_GNU_ABI_TAG (ABI version tag) OS: Linux, ABI: 2.6.32
Displaying notes found at file offset 0x00000274 with length 0x00000024:
Owner Data size Description
GNU 0x00000014 NT_GNU_BUILD_ID (unique build ... | Displaying notes found at file offset 0x00000254 with length 0x00000020: Owner Data size Description GNU 0x00000010 NT_GNU_ABI_TAG (ABI version tag) OS: Linux, ABI: 2.6.32
Displaying notes found at file offset 0x00000274 with length 0x00000024:
Owner Data size Description
GNU 0x00000014 NT_GNU_BUILD_ID (unique build ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a86df781-9e7f-4486-b0d5-319cc766153c | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,204 | supabase-export-v2 | 3de636850c710cb7 | If you've built Python as a shared library (with the :option:`--enable-shared` configure option), you need to look instead within the shared library. For example::
$ readelf -S libpython3.3dm.so.1.0 | grep .note.stapsdt
[29] .note.stapsdt NOTE 0000000000000000 00365b68 | trusted_official_docs | CPython Docs | If you've built Python as a shared library (with the :option:`--enable-shared` configure option), you need to look instead within the shared library. For example::
$ readelf -S libpython3.3dm.so.1.0 | grep .note.stapsdt
[29] .note.stapsdt NOTE 0000000000000000 00365b68 | If you've built Python as a shared library (with the :option:`--enable-shared` configure option), you need to look instead within the shared library. For example::
$ readelf -S libpython3.3dm.so.1.0 | grep .note.stapsdt
[29] .note.stapsdt NOTE 0000000000000000 00365b68 | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
aa3e031e-e589-449d-98e2-ef6458fd552b | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,281 | supabase-export-v2 | 3991ff6896e60c63 | SystemTap Tapsets -----------------
The higher-level way to use the SystemTap integration is to use a "tapset":
SystemTap's equivalent of a library, which hides some of the lower-level
details of the static markers. | trusted_official_docs | CPython Docs | SystemTap Tapsets -----------------
The higher-level way to use the SystemTap integration is to use a "tapset":
SystemTap's equivalent of a library, which hides some of the lower-level
details of the static markers. | SystemTap Tapsets -----------------
The higher-level way to use the SystemTap integration is to use a "tapset":
SystemTap's equivalent of a library, which hides some of the lower-level
details of the static markers. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
af553475-dc63-4fc1-894b-1a2d2b71f03f | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,290 | supabase-export-v2 | ab24667b4bc79383 | and indicates that execution of a Python function has ended (either via ``return``, or via an exception). It is only triggered for pure-Python (bytecode) functions.
Examples
--------
This SystemTap script uses the tapset above to more cleanly implement the
example given above of tracing the Python function-call hierarc... | trusted_official_docs | CPython Docs | and indicates that execution of a Python function has ended (either via ``return``, or via an exception). It is only triggered for pure-Python (bytecode) functions.
Examples
--------
This SystemTap script uses the tapset above to more cleanly implement the
example given above of tracing the Python function-call hierarc... | and indicates that execution of a Python function has ended (either via ``return``, or via an exception). It is only triggered for pure-Python (bytecode) functions.
Examples
--------
This SystemTap script uses the tapset above to more cleanly implement the
example given above of tracing the Python function-call hierarc... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bafecf39-8d41-4688-8a01-91f84bd541ee | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,272 | supabase-export-v2 | 6df457de230da4e4 | Python's C API comes with a number of helper functions that mirror each static marker. On builds of Python without DTrace enabled, these do nothing.
In general, it is not necessary to call these yourself, as Python will do
it for you. | trusted_official_docs | CPython Docs | Python's C API comes with a number of helper functions that mirror each static marker. On builds of Python without DTrace enabled, these do nothing.
In general, it is not necessary to call these yourself, as Python will do
it for you. | Python's C API comes with a number of helper functions that mirror each static marker. On builds of Python without DTrace enabled, these do nothing.
In general, it is not necessary to call these yourself, as Python will do
it for you. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c0871a69-f473-4bf1-8091-91e951a20182 | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,200 | supabase-export-v2 | 944fc0744f9cb18d | 29567 python18035 python3.6 dtrace_function_return function-return 29568 python18035 python3.6 collect gc-done 29569 python18035 python3.6 collect gc-start 29570 python18035 python3.6 _PyEval_EvalFrameDefault line 29571 python18035 python3.6 maybe_dtrace_line line
On Linux, you can verify if the SystemTap static marker... | trusted_official_docs | CPython Docs | 29567 python18035 python3.6 dtrace_function_return function-return 29568 python18035 python3.6 collect gc-done 29569 python18035 python3.6 collect gc-start 29570 python18035 python3.6 _PyEval_EvalFrameDefault line 29571 python18035 python3.6 maybe_dtrace_line line
On Linux, you can verify if the SystemTap static marker... | 29567 python18035 python3.6 dtrace_function_return function-return 29568 python18035 python3.6 collect gc-done 29569 python18035 python3.6 collect gc-start 29570 python18035 python3.6 _PyEval_EvalFrameDefault line 29571 python18035 python3.6 maybe_dtrace_line line
On Linux, you can verify if the SystemTap static marker... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c52c89e4-4c16-49d9-8019-f278a50b51cc | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,216 | supabase-export-v2 | 01d9b70bf8fbf794 | python$target:::function-entry /self->trace/ { printf("%d\t%*s:", timestamp, 15, probename); printf("%*s", self->indent, ""); printf("%s:%s:%d\n", basename(copyinstr(arg0)), copyinstr(arg1), arg2); self->indent++; }
python$target:::function-return
/self->trace/
{
self->indent--;
printf("%d\t%*s:", timestamp, 15, pr... | trusted_official_docs | CPython Docs | python$target:::function-entry /self->trace/ { printf("%d\t%*s:", timestamp, 15, probename); printf("%*s", self->indent, ""); printf("%s:%s:%d\n", basename(copyinstr(arg0)), copyinstr(arg1), arg2); self->indent++; }
python$target:::function-return
/self->trace/
{
self->indent--;
printf("%d\t%*s:", timestamp, 15, pr... | python$target:::function-entry /self->trace/ { printf("%d\t%*s:", timestamp, 15, probename); printf("%*s", self->indent, ""); printf("%s:%s:%d\n", basename(copyinstr(arg0)), copyinstr(arg1), arg2); self->indent++; }
python$target:::function-return
/self->trace/
{
self->indent--;
printf("%d\t%*s:", timestamp, 15, pr... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cc45916e-eedd-44cb-bc08-276c7eb9ea82 | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,203 | supabase-export-v2 | 97982f808b098d45 | $ readelf -S ./python | grep .note.stapsdt [30] .note.stapsdt NOTE 0000000000000000 00308d78
If you've built Python as a shared library
(with the :option:`--enable-shared` configure option), you
need to look instead within the shared library. For example:: | trusted_official_docs | CPython Docs | $ readelf -S ./python | grep .note.stapsdt [30] .note.stapsdt NOTE 0000000000000000 00308d78
If you've built Python as a shared library
(with the :option:`--enable-shared` configure option), you
need to look instead within the shared library. For example:: | $ readelf -S ./python | grep .note.stapsdt [30] .note.stapsdt NOTE 0000000000000000 00308d78
If you've built Python as a shared library
(with the :option:`--enable-shared` configure option), you
need to look instead within the shared library. For example:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dc1353c5-e01b-44bc-ab40-0bd3ce43df44 | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,223 | supabase-export-v2 | 547db1236912afa8 | Static SystemTap markers ------------------------
The low-level way to use the SystemTap integration is to use the static
markers directly. This requires you to explicitly state the binary file
containing them. | trusted_official_docs | CPython Docs | Static SystemTap markers ------------------------
The low-level way to use the SystemTap integration is to use the static
markers directly. This requires you to explicitly state the binary file
containing them. | Static SystemTap markers ------------------------
The low-level way to use the SystemTap integration is to use the static
markers directly. This requires you to explicitly state the binary file
containing them. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dc5d1bfb-4d5f-405a-a54d-7a166cef4426 | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,233 | supabase-export-v2 | 0521a21990239bd1 | .. code-block:: none
11408 python(8274): => __contains__ in Lib/_abcoll.py:362
11414 python(8274): => __getitem__ in Lib/os.py:425
11418 python(8274): => encode in Lib/os.py:490
11424 python(8274): <= encode in Lib/os.py:493
11428 python(8274): <= __getitem__ in Lib/os.py:426
11433 python(8274): <= __contains__ in... | trusted_official_docs | CPython Docs | .. code-block:: none
11408 python(8274): => __contains__ in Lib/_abcoll.py:362
11414 python(8274): => __getitem__ in Lib/os.py:425
11418 python(8274): => encode in Lib/os.py:490
11424 python(8274): <= encode in Lib/os.py:493
11428 python(8274): <= __getitem__ in Lib/os.py:426
11433 python(8274): <= __contains__ in... | .. code-block:: none
11408 python(8274): => __contains__ in Lib/_abcoll.py:362
11414 python(8274): => __getitem__ in Lib/os.py:425
11418 python(8274): => encode in Lib/os.py:490
11424 python(8274): <= encode in Lib/os.py:493
11428 python(8274): <= __getitem__ in Lib/os.py:426
11433 python(8274): <= __contains__ in... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
df98c3ed-9fee-4d5d-baed-1d5aeb86ab65 | CPython Docs | file://datasets/cpython/Doc/howto/instrumentation.rst | unknown | e5955c1e-3252-479b-a3cd-147ab507d1ef | 60,192 | supabase-export-v2 | facc3f912c0eb7cf | with built-in support for DTrace. On Linux, in order to build CPython with the embedded markers for SystemTap, the SystemTap development tools must be installed.
On a Linux machine, this can be done via:: | trusted_official_docs | CPython Docs | with built-in support for DTrace. On Linux, in order to build CPython with the embedded markers for SystemTap, the SystemTap development tools must be installed.
On a Linux machine, this can be done via:: | with built-in support for DTrace. On Linux, in order to build CPython with the embedded markers for SystemTap, the SystemTap development tools must be installed.
On a Linux machine, this can be done via:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.