diff options
author | Christian Heimes <christian@cheimes.de> | 2013-07-21 02:12:44 +0200 |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2013-07-21 02:12:44 +0200 |
commit | 84e3a020089fe73ab1a7fe4a4d9d6687e53270f2 (patch) | |
tree | fd142c1be8d8910be40fae67be7691e107859232 /Python/traceback.c | |
parent | ddf873f3236ddd20e30876020d8c446d69e64b7a (diff) | |
parent | c9354609015d2c617aa723cd531a4742ede2e34a (diff) | |
download | cpython-84e3a020089fe73ab1a7fe4a4d9d6687e53270f2.tar.gz |
Check return value of lseek() in _Py_DisplaySourceLine().
Also use portable SEEK_SET instead of 0.
CID 1040639
Diffstat (limited to 'Python/traceback.c')
-rw-r--r-- | Python/traceback.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Python/traceback.c b/Python/traceback.c index 1f611ba1d5..31015800c7 100644 --- a/Python/traceback.c +++ b/Python/traceback.c @@ -13,7 +13,7 @@ #define OFF(x) offsetof(PyTracebackObject, x) -#define PUTS(fd, str) write(fd, str, strlen(str)) +#define PUTS(fd, str) write(fd, str, (int)strlen(str)) #define MAX_STRING_LENGTH 500 #define MAX_FRAME_DEPTH 100 #define MAX_NTHREADS 100 @@ -246,10 +246,12 @@ _Py_DisplaySourceLine(PyObject *f, PyObject *filename, int lineno, int indent) binary = _PyObject_CallMethodId(io, &PyId_open, "Os", filename, "rb"); if (binary == NULL) { + PyErr_Clear(); + binary = _Py_FindSourceFile(filename, buf, sizeof(buf), io); if (binary == NULL) { Py_DECREF(io); - return 0; + return -1; } } |