diff options
Diffstat (limited to 'pexpect/expect.py')
-rw-r--r-- | pexpect/expect.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/pexpect/expect.py b/pexpect/expect.py index db376d5..34a2c93 100644 --- a/pexpect/expect.py +++ b/pexpect/expect.py @@ -60,7 +60,10 @@ class Expecter(object): msg += '\nsearcher: %s' % self.searcher if err is not None: msg = str(err) + '\n' + msg - raise EOF(msg) + + exc = EOF(msg) + exc.__cause__ = None # in Python 3.x we can use "raise exc from None" + raise exc def timeout(self, err=None): spawn = self.spawn @@ -79,7 +82,10 @@ class Expecter(object): msg += '\nsearcher: %s' % self.searcher if err is not None: msg = str(err) + '\n' + msg - raise TIMEOUT(msg) + + exc = TIMEOUT(msg) + exc.__cause__ = None # in Python 3.x we can use "raise exc from None" + raise exc def errored(self): spawn = self.spawn |