bpo-46332: use raise..from instead of assigning __cause__ and raising (GH-30517)

This commit is contained in:
Irit Katriel 2022-01-10 18:59:21 +00:00 committed by GitHub
parent ec0c392f34
commit 0d639678d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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."""