summaryrefslogtreecommitdiff
path: root/Python/traceback.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-07-30 20:09:36 +0200
committerAntoine Pitrou <solipsis@pitrou.net>2013-07-30 20:09:36 +0200
commitdea573ec3aa5f526017a9b121cc574173f7e0e7f (patch)
tree643be57ade4e8b3a9960b7addd96c6bba6f2e85f /Python/traceback.c
parentcd097b5262a96c2bea85ad0000c269ceea9f5089 (diff)
parent3e0aaf3e7d782ca7e08de2ba352be9c80d634dbe (diff)
downloadcpython-dea573ec3aa5f526017a9b121cc574173f7e0e7f.tar.gz
Merge doc fix
Diffstat (limited to 'Python/traceback.c')
-rw-r--r--Python/traceback.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Python/traceback.c b/Python/traceback.c
index 74075c9481..4f2e732779 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;
}
}