Commit f9290773 authored by Christian Heimes's avatar Christian Heimes

Reverting last commit. I had some staled data from an attempted svnmerge in my local sandbox

parent e69c320d
...@@ -135,13 +135,6 @@ The following exceptions are the exceptions that are actually raised. ...@@ -135,13 +135,6 @@ The following exceptions are the exceptions that are actually raised.
.. exception:: GeneratorExit .. exception:: GeneratorExit
Raise when a :term:`generator`\'s :meth:`close` method is called. It
directly inherits from :exc:`BaseException` instead of :exc:`Exception` since
it is technically not an error.
.. versionchanged:: 3.0
Changed to inherit from :exc:`BaseException`.
Raise when a :term:`generator`\'s :meth:`close` method is called. Raise when a :term:`generator`\'s :meth:`close` method is called.
......
...@@ -413,6 +413,9 @@ generator functions:: ...@@ -413,6 +413,9 @@ generator functions::
... while True: ... while True:
... try: ... try:
... value = (yield value) ... value = (yield value)
... except GeneratorExit:
... # never catch GeneratorExit
... raise
... except Exception, e: ... except Exception, e:
... value = e ... value = e
... finally: ... finally:
......
This diff is collapsed.
BaseException BaseException
+-- SystemExit +-- SystemExit
+-- KeyboardInterrupt +-- KeyboardInterrupt
+-- GeneratorExit
+-- Exception +-- Exception
+-- GeneratorExit
+-- StopIteration +-- StopIteration
+-- ArithmeticError +-- ArithmeticError
| +-- FloatingPointError | +-- FloatingPointError
......
...@@ -1668,19 +1668,6 @@ And finalization: ...@@ -1668,19 +1668,6 @@ And finalization:
exiting exiting
GeneratorExit is not caught by except Exception:
>>> def f():
... try: yield
... except Exception: print 'except'
... finally: print 'finally'
>>> g = f()
>>> g.next()
>>> del g
finally
Now let's try some ill-behaved generators: Now let's try some ill-behaved generators:
>>> def f(): >>> def f():
......
...@@ -245,8 +245,6 @@ Extension Modules ...@@ -245,8 +245,6 @@ Extension Modules
* operator module: div, idiv, __div__, __idiv__, isCallable, sequenceIncludes * operator module: div, idiv, __div__, __idiv__, isCallable, sequenceIncludes
* sys module: exc_clear(), exc_type, exc_value, exc_traceback * sys module: exc_clear(), exc_type, exc_value, exc_traceback
- Issue #1537: Changed GeneratorExit's base class from Exception to BaseException.
Library Library
------- -------
......
...@@ -424,9 +424,9 @@ SimpleExtendsException(PyExc_Exception, StopIteration, ...@@ -424,9 +424,9 @@ SimpleExtendsException(PyExc_Exception, StopIteration,
/* /*
* GeneratorExit extends BaseException * GeneratorExit extends Exception
*/ */
SimpleExtendsException(PyExc_BaseException, GeneratorExit, SimpleExtendsException(PyExc_Exception, GeneratorExit,
"Request that a generator exit."); "Request that a generator exit.");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment