mirror of
https://github.com/python/cpython
synced 2024-10-14 10:48:24 +00:00
bpo-46332: use raise..from instead of assigning __cause__ and raising (GH-30517)
This commit is contained in:
parent
ec0c392f34
commit
0d639678d3
|
@ -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."""
|
||||
|
|
Loading…
Reference in a new issue