|
2 | 2 |
|
3 | 3 | import threading |
4 | 4 | import sys |
| 5 | +import six |
5 | 6 | from six import string_types |
6 | 7 |
|
7 | 8 | # Python3 queue support. |
| 9 | + |
8 | 10 | try: |
9 | 11 | import Queue |
10 | 12 | except ImportError: |
@@ -66,7 +68,7 @@ def put(self, task, *args, **kwargs): |
66 | 68 |
|
67 | 69 | def raise_exceptions(self): |
68 | 70 | if self.exception_event.is_set(): |
69 | | - raise self.exc_info[0], self.exc_info[1], self.exc_info[2] |
| 71 | + six.reraise(self.exc_info[0], self.exc_info[1], self.exc_info[2]) |
70 | 72 |
|
71 | 73 | def clear_exceptions(self): |
72 | 74 | self.exception_event.clear() |
@@ -96,7 +98,7 @@ def on_exception(self, worker_thread, exc_info): |
96 | 98 |
|
97 | 99 | def raise_exceptions(self): |
98 | 100 | if self.exception_event.is_set(): |
99 | | - raise self.exc_info[0], self.exc_info[1], self.exc_info[2] |
| 101 | + six.reraise(self.exc_info[0], self.exc_info[1], self.exc_info[2]) |
100 | 102 |
|
101 | 103 | def clear_exceptions(self): |
102 | 104 | self.exception_event.clear() |
@@ -129,7 +131,7 @@ def wait(self): |
129 | 131 | if not self.done: |
130 | 132 | self.thread.join() |
131 | 133 | if isinstance(self.result, BaseException): |
132 | | - raise self.result[0], self.result[1], self.result[2] |
| 134 | + six.reraise(self.result[0], self.result[1], self.result[2]) |
133 | 135 | else: |
134 | 136 | return self.result |
135 | 137 |
|
|
0 commit comments