Skip to content

Commit d56e700

Browse files
author
Machinexa2
authored
Use from imports (GH-26594)
from imports
1 parent 227a093 commit d56e700

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Lib/concurrent/futures/process.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
from functools import partial
5757
import itertools
5858
import sys
59-
import traceback
59+
from traceback import format_exception
6060

6161

6262
_threads_wakeups = weakref.WeakKeyDictionary()
@@ -123,8 +123,7 @@ def __str__(self):
123123

124124
class _ExceptionWithTraceback:
125125
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))
128127
self.exc = exc
129128
self.tb = '\n"""\n%s"""' % tb
130129
def __reduce__(self):
@@ -166,7 +165,7 @@ def __init__(self, max_size=0, *, ctx, pending_work_items, shutdown_lock,
166165

167166
def _on_queue_feeder_error(self, e, obj):
168167
if isinstance(obj, _CallItem):
169-
tb = traceback.format_exception(type(e), e, e.__traceback__)
168+
tb = format_exception(type(e), e, e.__traceback__)
170169
e.__cause__ = _RemoteTraceback('\n"""\n{}"""'.format(''.join(tb)))
171170
work_item = self.pending_work_items.pop(obj.work_id, None)
172171
with self.shutdown_lock:
@@ -384,7 +383,7 @@ def wait_result_broken_or_wakeup(self):
384383
result_item = result_reader.recv()
385384
is_broken = False
386385
except BaseException as e:
387-
cause = traceback.format_exception(type(e), e, e.__traceback__)
386+
cause = format_exception(type(e), e, e.__traceback__)
388387

389388
elif wakeup_reader in ready:
390389
is_broken = False

0 commit comments

Comments
 (0)