mirror of
https://github.com/python/cpython.git
synced 2025-11-24 20:30:18 +00:00
gh-102799: use exception instance instead of sys.exc_info() (#102885)
This commit is contained in:
parent
c1e71ce56f
commit
44bd3fe570
7 changed files with 16 additions and 17 deletions
|
|
@ -190,11 +190,11 @@ def addpackage(sitedir, name, known_paths):
|
|||
if not dircase in known_paths and os.path.exists(dir):
|
||||
sys.path.append(dir)
|
||||
known_paths.add(dircase)
|
||||
except Exception:
|
||||
except Exception as exc:
|
||||
print("Error processing line {:d} of {}:\n".format(n+1, fullname),
|
||||
file=sys.stderr)
|
||||
import traceback
|
||||
for record in traceback.format_exception(*sys.exc_info()):
|
||||
for record in traceback.format_exception(exc):
|
||||
for line in record.splitlines():
|
||||
print(' '+line, file=sys.stderr)
|
||||
print("\nRemainder of file ignored", file=sys.stderr)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue