Issue #118 new

Exceptions are cleared during eventlet.tpool.execute

David Townshend avatarDavid Townshend created an issue

This report is the result of a question raised on stackoverflow: http://stackoverflow.com/questions/9525220/sqlalchemy-raises-none-causes-typeerror

The bug is that calling eventlet.tpool.execute() while handling an exception results in the exception being cleared. For example:

from eventlet import tpool

def m(): 
    pass

try:
    raise TypeError
except:
    tpool.execute(m)
    raise

The result is

TypeError: exceptions must be old-style classes or derived from BaseException, not NoneType

A workaround is to simply use

except Exception, e:
    tpool.execute(m)
    raise e

However, this is not really ideal since clearing the exception is somewhat unexpected. Unfortunately I don't know eventlet well enough to have any idea how to fix this, other than manually recording and re-raising the exception within eventlet.tpool.execute. This problem might occur in other places too though, so I don't know if that would be the best solution.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.