Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e69c320

Browse files
committed
Patch #1537 from Chad Austin
Change GeneratorExit's base class from Exception to BaseException
1 parent 6554cb9 commit e69c320

7 files changed

Lines changed: 683 additions & 6 deletions

File tree

Doc/library/exceptions.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,13 @@ The following exceptions are the exceptions that are actually raised.
135135

136136
.. exception:: GeneratorExit
137137

138+
Raise when a :term:`generator`\'s :meth:`close` method is called. It
139+
directly inherits from :exc:`BaseException` instead of :exc:`Exception` since
140+
it is technically not an error.
141+
142+
.. versionchanged:: 3.0
143+
Changed to inherit from :exc:`BaseException`.
144+
138145
Raise when a :term:`generator`\'s :meth:`close` method is called.
139146

140147

Doc/reference/expressions.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,6 @@ generator functions::
413413
... while True:
414414
... try:
415415
... value = (yield value)
416-
... except GeneratorExit:
417-
... # never catch GeneratorExit
418-
... raise
419416
... except Exception, e:
420417
... value = e
421418
... finally:

0 commit comments

Comments
 (0)