]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-46332: use raise..from instead of assigning __cause__ and raising (GH-30517)
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>
Mon, 10 Jan 2022 18:59:21 +0000 (18:59 +0000)
committerGitHub <noreply@github.com>
Mon, 10 Jan 2022 18:59:21 +0000 (18:59 +0000)
Lib/logging/config.py

index 3bc63b78621abae6b697f4f0d5b122ae5750a312..9bc07eddd76b4484316a4ee4c25e040221adbff6 100644 (file)
@@ -30,7 +30,6 @@ import logging
 import logging.handlers
 import re
 import struct
-import sys
 import threading
 import traceback
 
@@ -392,11 +391,9 @@ class BaseConfigurator(object):
                     self.importer(used)
                     found = getattr(found, frag)
             return found
-        except ImportError:
-            e, tb = sys.exc_info()[1:]
+        except ImportError as e:
             v = ValueError('Cannot resolve %r: %s' % (s, e))
-            v.__cause__, v.__traceback__ = e, tb
-            raise v
+            raise v from e
 
     def ext_convert(self, value):
         """Default converter for the ext:// protocol."""