diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-12-18 10:23:29 +0200 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-12-18 10:23:29 +0200 |
commit | 96a5a59824a3e78fcd0be5a2c3187d05f4e4e821 (patch) | |
tree | 390d34f121871765d0a32fe7b2aa92247f5a1571 /Python/pythonrun.c | |
parent | 483ee7b6955739a3ba30ef7d3a3491c33b9f928a (diff) | |
parent | a47c6d5b7611f1b5299065e4c167f40993ebb525 (diff) | |
download | cpython-96a5a59824a3e78fcd0be5a2c3187d05f4e4e821.tar.gz |
Test UTF-32LE before UTF-16LE since UTF-16LE BOM is a prefix of UTF-32LE BOM.
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r-- | Python/pythonrun.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c index ebedd123f3..1a5dab5f3a 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -431,7 +431,7 @@ static int parse_syntax_error(PyObject *err, PyObject **message, PyObject **filename, int *lineno, int *offset, PyObject **text) { - long hold; + int hold; PyObject *v; _Py_IDENTIFIER(msg); _Py_IDENTIFIER(filename); @@ -464,11 +464,11 @@ parse_syntax_error(PyObject *err, PyObject **message, PyObject **filename, v = _PyObject_GetAttrId(err, &PyId_lineno); if (!v) goto finally; - hold = PyLong_AsLong(v); + hold = _PyLong_AsInt(v); Py_DECREF(v); if (hold < 0 && PyErr_Occurred()) goto finally; - *lineno = (int)hold; + *lineno = hold; v = _PyObject_GetAttrId(err, &PyId_offset); if (!v) @@ -477,11 +477,11 @@ parse_syntax_error(PyObject *err, PyObject **message, PyObject **filename, *offset = -1; Py_DECREF(v); } else { - hold = PyLong_AsLong(v); + hold = _PyLong_AsInt(v); Py_DECREF(v); if (hold < 0 && PyErr_Occurred()) goto finally; - *offset = (int)hold; + *offset = hold; } v = _PyObject_GetAttrId(err, &PyId_text); |