Issue #3137: Don't ignore errors at startup, especially a keyboard interrupt
(SIGINT). If an error occurs while importing the site module, the error is
printed and Python exits. Initialize the GIL before importing the site
module.
diff --git a/Lib/site.py b/Lib/site.py
index 612122e..02129aa 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -489,6 +489,12 @@
import sitecustomize
except ImportError:
pass
+ except Exception:
+ if sys.flags.verbose:
+ sys.excepthook(*sys.exc_info())
+ else:
+ print >>sys.stderr, \
+ "'import sitecustomize' failed; use -v for traceback"
def execusercustomize():
@@ -497,6 +503,12 @@
import usercustomize
except ImportError:
pass
+ except Exception:
+ if sys.flags.verbose:
+ sys.excepthook(*sys.exc_info())
+ else:
+ print>>sys.stderr, \
+ "'import sitecustomize' failed; use -v for traceback"
def main():