An implementation of select.select() that blocks only the current greenlet.
Note: xlist is ignored.
Helper to make function return an exception, rather than raise it.
Because every exception that is unhandled by greenlet will be logged, it is desirable to prevent non-error exceptions from leaving a greenlet. This can done with simple try/except construct:
def wrapped_func(*args, **kwargs):
try:
return func(*args, **kwargs)
except (A, B, C), ex:
return ex
wrap_errors provides a shortcut to write that in one line:
wrapped_func = wrap_errors((A, B, C), func)
It also preserves __str__ and __repr__ of the original function.