mirror of
https://github.com/python/cpython.git
synced 2025-11-02 11:08:57 +00:00
GH-116090: Fix test and clarify behavior for exception events when exhausting a generator. (GH-120697)
This commit is contained in:
parent
95a73917cd
commit
2c42e13e80
2 changed files with 33 additions and 6 deletions
|
|
@ -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
|
||||
-------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue