diff options
author | Mark Shannon <mark@hotpy.org> | 2024-07-26 13:37:35 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-26 13:37:35 (GMT) |
commit | 2c42e13e80610a9dedcb15b57d142602e8143481 (patch) | |
tree | 9a7402efafe3566bb17ad14dd52dac7a785debed /Doc/library | |
parent | 95a73917cd5a204979a78c13ba912621f1eeb2e3 (diff) | |
download | cpython-2c42e13e80610a9dedcb15b57d142602e8143481.zip cpython-2c42e13e80610a9dedcb15b57d142602e8143481.tar.gz cpython-2c42e13e80610a9dedcb15b57d142602e8143481.tar.bz2 |
GH-116090: Fix test and clarify behavior for exception events when exhausting a generator. (GH-120697)
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/sys.monitoring.rst | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Doc/library/sys.monitoring.rst b/Doc/library/sys.monitoring.rst index 0fa06da..3ead208 100644 --- a/Doc/library/sys.monitoring.rst +++ b/Doc/library/sys.monitoring.rst @@ -226,6 +226,10 @@ To allow tools to monitor for real exceptions without slowing down generators and coroutines, the :monitoring-event:`STOP_ITERATION` event is provided. :monitoring-event:`STOP_ITERATION` can be locally disabled, unlike :monitoring-event:`RAISE`. +Note that the :monitoring-event:`STOP_ITERATION` event and the :monitoring-event:`RAISE` +event for a :exc:`StopIteration` exception are equivalent, and are treated as interchangeable +when generating events. Implementations will favor :monitoring-event:`STOP_ITERATION` for +performance reasons, but may generate a :monitoring-event:`RAISE` event with a :exc:`StopIteration`. Turning events on and off ------------------------- |