summaryrefslogtreecommitdiffstats
path: root/Lib/site.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-03-10 22:30:19 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-03-10 22:30:19 (GMT)
commit6664426d7cdb63b88d973a731cc442ecba10047a (patch)
tree7c809077569e93086eb42e1e29eea8fb5c6eb582 /Lib/site.py
parente9e07bf5c988bdfe4158d3ac14b25312430f1bd0 (diff)
downloadcpython-6664426d7cdb63b88d973a731cc442ecba10047a.zip
cpython-6664426d7cdb63b88d973a731cc442ecba10047a.tar.gz
cpython-6664426d7cdb63b88d973a731cc442ecba10047a.tar.bz2
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.
Diffstat (limited to 'Lib/site.py')
-rw-r--r--Lib/site.py12
1 files changed, 12 insertions, 0 deletions
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 @@ def execsitecustomize():
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 @@ def execusercustomize():
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():