[Python-checkins] bpo-46332: use raise..from instead of assigning __cause__ and raising (GH-30517)
iritkatriel
webhook-mailer at python.org
Mon Jan 10 13:59:36 EST 2022
https://github.com/python/cpython/commit/0d639678d33a0f085851a07259b8fe2782943118
commit: 0d639678d33a0f085851a07259b8fe2782943118
branch: main
author: Irit Katriel <1055913+iritkatriel at users.noreply.github.com>
committer: iritkatriel <1055913+iritkatriel at users.noreply.github.com>
date: 2022-01-10T18:59:21Z
summary:
bpo-46332: use raise..from instead of assigning __cause__ and raising (GH-30517)
files:
M Lib/logging/config.py
diff --git a/Lib/logging/config.py b/Lib/logging/config.py
index 3bc63b78621ab..9bc07eddd76b4 100644
--- a/Lib/logging/config.py
+++ b/Lib/logging/config.py
@@ -30,7 +30,6 @@
import logging.handlers
import re
import struct
-import sys
import threading
import traceback
@@ -392,11 +391,9 @@ def resolve(self, s):
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."""
More information about the Python-checkins
mailing list