Commit d3e7ad56 authored by Jason Madden's avatar Jason Madden

exc_info on a successfully finished greenlet shouldn't raise. Fixes #821

parent 7cf9b6a5
......@@ -309,10 +309,16 @@ class Greenlet(greenlet):
@property
def exc_info(self):
"""Holds the exc_info three-tuple raised by the function if the greenlet finished with an error.
Otherwise a false value."""
"""
Holds the exc_info three-tuple raised by the function if the
greenlet finished with an error. Otherwise a false value.
.. note:: This is a provisional API and may change.
.. versionadded:: 1.1
"""
e = self._exc_info
if e:
if e and e[0] is not None:
return (e[0], e[1], load_traceback(e[2]))
def throw(self, *args):
......
......@@ -650,6 +650,14 @@ class TestBasic(greentest.TestCase):
def test_kill_running_noblock(self):
self._test_kill_running(block=False)
def test_exc_info_no_error(self):
# Before running
self.assertFalse(greenlet.Greenlet().exc_info)
g = greenlet.Greenlet(gevent.sleep)
g.start()
g.join()
self.assertFalse(g.exc_info)
class TestStart(greentest.TestCase):
......
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