|
56 | 56 | from functools import partial
|
57 | 57 | import itertools
|
58 | 58 | import sys
|
59 |
| -import traceback |
| 59 | +from traceback import format_exception |
60 | 60 |
|
61 | 61 |
|
62 | 62 | _threads_wakeups = weakref.WeakKeyDictionary()
|
@@ -123,8 +123,7 @@ def __str__(self):
|
123 | 123 |
|
124 | 124 | class _ExceptionWithTraceback:
|
125 | 125 | def __init__(self, exc, tb):
|
126 |
| - tb = traceback.format_exception(type(exc), exc, tb) |
127 |
| - tb = ''.join(tb) |
| 126 | + tb = ''.join(format_exception(type(exc), exc, tb)) |
128 | 127 | self.exc = exc
|
129 | 128 | self.tb = '\n"""\n%s"""' % tb
|
130 | 129 | def __reduce__(self):
|
@@ -166,7 +165,7 @@ def __init__(self, max_size=0, *, ctx, pending_work_items, shutdown_lock,
|
166 | 165 |
|
167 | 166 | def _on_queue_feeder_error(self, e, obj):
|
168 | 167 | if isinstance(obj, _CallItem):
|
169 |
| - tb = traceback.format_exception(type(e), e, e.__traceback__) |
| 168 | + tb = format_exception(type(e), e, e.__traceback__) |
170 | 169 | e.__cause__ = _RemoteTraceback('\n"""\n{}"""'.format(''.join(tb)))
|
171 | 170 | work_item = self.pending_work_items.pop(obj.work_id, None)
|
172 | 171 | with self.shutdown_lock:
|
@@ -384,7 +383,7 @@ def wait_result_broken_or_wakeup(self):
|
384 | 383 | result_item = result_reader.recv()
|
385 | 384 | is_broken = False
|
386 | 385 | except BaseException as e:
|
387 |
| - cause = traceback.format_exception(type(e), e, e.__traceback__) |
| 386 | + cause = format_exception(type(e), e, e.__traceback__) |
388 | 387 |
|
389 | 388 | elif wakeup_reader in ready:
|
390 | 389 | is_broken = False
|
|
0 commit comments