]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Use `from` imports (GH-26594)
authorMachinexa2 <darkwebmachine@gmail.com>
Tue, 8 Jun 2021 09:47:15 +0000 (15:32 +0545)
committerGitHub <noreply@github.com>
Tue, 8 Jun 2021 09:47:15 +0000 (06:47 -0300)
from imports

Lib/concurrent/futures/process.py

index 764719859f7cea583fcc2abbac270d25a28a7cb3..9904db78c5b4cef6948806ab535644d6ee7ed20c 100644 (file)
@@ -56,7 +56,7 @@ import weakref
 from functools import partial
 import itertools
 import sys
-import traceback
+from traceback import format_exception
 
 
 _threads_wakeups = weakref.WeakKeyDictionary()
@@ -123,8 +123,7 @@ class _RemoteTraceback(Exception):
 
 class _ExceptionWithTraceback:
     def __init__(self, exc, tb):
-        tb = traceback.format_exception(type(exc), exc, tb)
-        tb = ''.join(tb)
+        tb = ''.join(format_exception(type(exc), exc, tb))
         self.exc = exc
         self.tb = '\n"""\n%s"""' % tb
     def __reduce__(self):
@@ -166,7 +165,7 @@ class _SafeQueue(Queue):
 
     def _on_queue_feeder_error(self, e, obj):
         if isinstance(obj, _CallItem):
-            tb = traceback.format_exception(type(e), e, e.__traceback__)
+            tb = format_exception(type(e), e, e.__traceback__)
             e.__cause__ = _RemoteTraceback('\n"""\n{}"""'.format(''.join(tb)))
             work_item = self.pending_work_items.pop(obj.work_id, None)
             with self.shutdown_lock:
@@ -384,7 +383,7 @@ class _ExecutorManagerThread(threading.Thread):
                 result_item = result_reader.recv()
                 is_broken = False
             except BaseException as e:
-                cause = traceback.format_exception(type(e), e, e.__traceback__)
+                cause = format_exception(type(e), e, e.__traceback__)
 
         elif wakeup_reader in ready:
             is_broken = False