site: don't import traceback at startup to speed up Python startup

This commit is contained in:
Victor Stinner 2012-02-21 22:10:16 +01:00
parent c9f54cf512
commit 65532111b4
1 changed files with 1 additions and 1 deletions

View File

@ -55,7 +55,6 @@ ImportError exception, it is silently ignored.
import sys
import os
import builtins
import traceback
# Prefixes for site-packages; add additional prefixes like /usr/local here
PREFIXES = [sys.prefix, sys.exec_prefix]
@ -157,6 +156,7 @@ def addpackage(sitedir, name, known_paths):
except Exception:
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 line in record.splitlines():
print(' '+line, file=sys.stderr)