Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Pushed Handlers Create Cyclic References with __del__() #46

Closed
drakeguan opened this Issue · 2 comments

2 participants

@drakeguan

This prevents handlers from being closeed on exit if pop_application is not called.

@vmalloc
Collaborator

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():

with h1:
    sys.exit() 

This will cause h1 to be popped right before the exception propagation, causing it to be properly collected.

@vmalloc
Collaborator

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.

@vmalloc vmalloc closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.