diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-03-10 22:30:19 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-03-10 22:30:19 (GMT) |
commit | 6664426d7cdb63b88d973a731cc442ecba10047a (patch) | |
tree | 7c809077569e93086eb42e1e29eea8fb5c6eb582 /Modules/main.c | |
parent | e9e07bf5c988bdfe4158d3ac14b25312430f1bd0 (diff) | |
download | cpython-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 'Modules/main.c')
-rw-r--r-- | Modules/main.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Modules/main.c b/Modules/main.c index 1511dd9..7f98ed0 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -573,10 +573,16 @@ Py_Main(int argc, char **argv) } if (sts==-1) { - sts = PyRun_AnyFileExFlags( - fp, - filename == NULL ? "<stdin>" : filename, - filename != NULL, &cf) != 0; + /* call pending calls like signal handlers (SIGINT) */ + if (Py_MakePendingCalls() == -1) { + PyErr_Print(); + sts = 1; + } else { + sts = PyRun_AnyFileExFlags( + fp, + filename == NULL ? "<stdin>" : filename, + filename != NULL, &cf) != 0; + } } } |