Commit 477e7ca2 authored by Denis Bilenko's avatar Denis Bilenko

hub.py: do sys.exc_clear() after switch_out() rather than before

parent 16b8e316
...@@ -171,13 +171,13 @@ class Hub(greenlet): ...@@ -171,13 +171,13 @@ class Hub(greenlet):
assert cur is not self, 'Impossible to call blocking function in the event loop callback' assert cur is not self, 'Impossible to call blocking function in the event loop callback'
exc_info = sys.exc_info() exc_info = sys.exc_info()
try: try:
sys.exc_clear()
switch_out = getattr(cur, 'switch_out', None) switch_out = getattr(cur, 'switch_out', None)
if switch_out is not None: if switch_out is not None:
try: try:
switch_out() switch_out()
except: except:
traceback.print_exc() traceback.print_exc()
sys.exc_clear()
return greenlet.switch(self) return greenlet.switch(self)
finally: finally:
core.set_exc_info(*exc_info) core.set_exc_info(*exc_info)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment