diff options
| author | Red_M <1468433+Red-M@users.noreply.github.com> | 2019-12-17 21:15:29 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-12-17 21:15:29 +1000 |
| commit | 692681f719ecca280c77e3a04c24ef8be64696a4 (patch) | |
| tree | ec0bfd53f8e985899f78707caeb2525b201efcf4 | |
| parent | fa6a55691c1a3310c30c1816b06e9d6e62488ce2 (diff) | |
| parent | f98485ae7ddd2786f2d0fc6234d15f9f1e55caea (diff) | |
| download | pexpect-692681f719ecca280c77e3a04c24ef8be64696a4.tar.gz | |
Merge pull request #606 from eldipa/Issue605-Disable-Chaining-Timeout-EOF-Exception
Disable chaining Timeout and EOF exceptions
| -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 |
