Module Expr Str ClassDef bases NameLoad body Expr Str decorator_list FunctionDef arguments args defaults body Print Str TryFinally body While NameLoad body TryExcept body Assign NameStore Yield handlers ExceptHandler type NameLoad body Print Str orelse Print Call AttributeLoad Str attr NameLoad finalbody Print Str decorator_list
N/A N/A 
Second coroutine closing demonstration::

    >>> fin_coro = demo_finally()
    >>> next(fin_coro)
    -> coroutine started
    >>> fin_coro.send(11)
    -> coroutine received: 11
    >>> fin_coro.send(22)
    -> coroutine received: 22
    >>> fin_coro.close()
    -> coroutine ending


Second coroutine not handling exception::

    >>> fin_coro = demo_finally()
    >>> next(fin_coro)
    -> coroutine started
    >>> fin_coro.send(11)
    -> coroutine received: 11
    >>> fin_coro.throw(ZeroDivisionError)  # doctest: +SKIP
    -> coroutine ending
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "coro_exception_demos.py", line 109, in demo_finally
        print('-> coroutine received: {!r}'.format(x))
    ZeroDivisionError


The last test above must be skipped because the output '-> coroutine ending'
is not detected by doctest, which raises a false error. However, if you
run this file as shown below, you'll see that output "leak" into standard
output::


    $ python3 -m doctest coro_exception_demos.py
    -> coroutine ending

 DemoException N/A Exception N/A N/A An exception type for the demonstration. N/A demo_finally N/A N/A N/A N/A N/A -> coroutine started N/A N/A N/A True N/A N/A N/A N/A x N/A N/A N/A N/A DemoException N/A N/A *** DemoException handled. Continuing... N/A N/A N/A N/A -> coroutine received: {!r} format x N/A N/A -> coroutine ending N/A