ID EN
Built-in Exceptions

GeneratorExit

Python 3.11

Raised when a generator or coroutine is closed; see generator.close() and coroutine.close(). It directly inherits from BaseException instead of Exception since it is technically not an error.

Syntax

PYTHON
exception GeneratorExit

See Also

generator coroutine generator.close() coroutine.close() BaseException Exception