summaryrefslogtreecommitdiffstats
path: root/Parser
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 /Parser
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 'Parser')
-rw-r--r--Parser/tokenizer.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index b881e7c..d60b256 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -817,8 +817,12 @@ error_nomem:
return -1;
error_clear:
- /* Fallback to iso-8859-1: for backward compatibility */
Py_DECREF(enc);
+ if (!PyErr_ExceptionMatches(PyExc_UnicodeDecodeError)) {
+ tok->done = E_ERROR;
+ return -1;
+ }
+ /* Fallback to iso-8859-1: for backward compatibility */
PyErr_Clear();
return 0;
}