FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Docs: Clarify generator.close() behavior regarding GeneratorExit by suryansh18saxena · Pull Request #135819 · python/cpython · GitHub

Repository navigation

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .rst  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
6 changes: 6 additions & 0 deletions Doc/library/stdtypes.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,12 @@ methods.
More information about generators can be found in :ref:`the documentation for
the yield expression <yieldexpr>`.

.. note::

Calling ``close()`` on a generator raises a ``GeneratorExit`` exception inside the generator
at the point where it is paused. If this exception is not caught or handled inside the
generator (for example, using ``try``/``except`` or ``finally``), then the call to
``close()`` will simply return ``None`` without raising any error to the caller.

.. _typesseq:

Expand Down

Back | FazBrowse Home | New Git URL