let's not return NULL from functions that should return ints

This commit is contained in:
Benjamin Peterson 2013-07-21 13:26:13 -07:00
parent 8c4c1f6e66
commit 04b01dc8f7
1 changed files with 2 additions and 2 deletions

View File

@ -258,7 +258,7 @@ _Py_DisplaySourceLine(PyObject *f, PyObject *filename, int lineno, int indent)
if (fd < 0) { if (fd < 0) {
Py_DECREF(io); Py_DECREF(io);
Py_DECREF(binary); Py_DECREF(binary);
return NULL; return 0;
} }
found_encoding = PyTokenizer_FindEncodingFilename(fd, filename); found_encoding = PyTokenizer_FindEncodingFilename(fd, filename);
encoding = (found_encoding != NULL) ? found_encoding : "utf-8"; encoding = (found_encoding != NULL) ? found_encoding : "utf-8";
@ -267,7 +267,7 @@ _Py_DisplaySourceLine(PyObject *f, PyObject *filename, int lineno, int indent)
Py_DECREF(io); Py_DECREF(io);
Py_DECREF(binary); Py_DECREF(binary);
PyMem_FREE(found_encoding); PyMem_FREE(found_encoding);
return PyErr_SetFromErrnoWithFilenameObject(PyExc_IOError, filename); return 0;
} }
fob = _PyObject_CallMethodId(io, &PyId_TextIOWrapper, "Os", binary, encoding); fob = _PyObject_CallMethodId(io, &PyId_TextIOWrapper, "Os", binary, encoding);
Py_DECREF(io); Py_DECREF(io);