core: CallError should handle any exception type.

Previously SystemExit would be pickled.
pull/255/head
David Wilson 6 years ago
parent faaac43a78
commit 78d375e0c5

@ -78,6 +78,11 @@ LOAD_MODULE = 107
DETACHING = 108
IS_DEAD = 999
try:
BaseException
except NameError:
BaseException = Exception
PY3 = sys.version_info > (3,)
if PY3:
b = lambda s: s.encode('latin-1')
@ -134,7 +139,7 @@ class Secret(UnicodeType):
class CallError(Error):
def __init__(self, fmt=None, *args):
if not isinstance(fmt, Exception):
if not isinstance(fmt, BaseException):
Error.__init__(self, fmt, *args)
else:
e = fmt

@ -22,6 +22,11 @@ class ConstructorTest(unittest2.TestCase):
e = self.klass(ve)
self.assertEquals(e[0], 'exceptions.ValueError: eek')
def test_form_base_exc(self):
ve = SystemExit('eek')
e = self.klass(ve)
self.assertEquals(e[0], 'exceptions.SystemExit: eek')
def test_from_exc_tb(self):
try:
raise ValueError('eek')

Loading…
Cancel
Save