8000 bpo-46332: use raise..from instead of assigning __cause__ and raising… · python/cpython@0d63967 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0d63967

Browse files
authored
bpo-46332: use raise..from instead of assigning __cause__ and raising (GH-30517)
1 parent ec0c392 commit 0d63967

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

Lib/logging/config.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import logging.handlers
3131
import re
3232
import struct
33-
import sys
3433
import threading
3534
import traceback
3635

@@ -392,11 +391,9 @@ def resolve(self, s):
392391
self.importer(used)
393392
found = getattr(found, frag)
394393
return found
395-
except ImportError:
396-
e, tb = sys.exc_info()[1:]
394+
except ImportError as e:
397395
v = ValueError('Cannot resolve %r: %s' % (s, e))
398-
v.__cause__, v.__traceback__ = e, tb
399-
raise v
396+
raise v from e
400397

401398
def ext_convert(self, value):
402399
"""Default converter for the ext:// protocol."""

0 commit comments

Comments
 (0)
0