You can clone with
HTTPS or Subversion.
This prevents handlers from being closeed on exit if pop_application is not called.
Yes. The handler is not popped from the stack in this example, meaning there's a cyclic reference with a del in it.
Solving this is tricky -- but you can easily work around this by using with instead of push_application():
This will cause h1 to be popped right before the exception propagation, causing it to be properly collected.
Going to leave this as unfixed for now. Python 3.4 is about to land with a proper fix for this issue in Python itself (properly handling cycles with destructors). If the workaround is not good enough for this issue feel free to comment or reopen so that we can discuss it further.