Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 04b01dc

Browse files
committed
let's not return NULL from functions that should return ints
1 parent 8c4c1f6 commit 04b01dc

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Python/traceback.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ _Py_DisplaySourceLine(PyObject *f, PyObject *filename, int lineno, int indent)
258258
if (fd < 0) {
259259
Py_DECREF(io);
260260
Py_DECREF(binary);
261-
return NULL;
261+
return 0;
262262
}
263263
found_encoding = PyTokenizer_FindEncodingFilename(fd, filename);
264264
encoding = (found_encoding != NULL) ? found_encoding : "utf-8";
@@ -267,7 +267,7 @@ _Py_DisplaySourceLine(PyObject *f, PyObject *filename, int lineno, int indent)
267267
Py_DECREF(io);
268268
Py_DECREF(binary);
269269
PyMem_FREE(found_encoding);
270-
return PyErr_SetFromErrnoWithFilenameObject(PyExc_IOError, filename);
270+
return 0;
271271
}
272272
fob = _PyObject_CallMethodId(io, &PyId_TextIOWrapper, "Os", binary, encoding);
273273
Py_DECREF(io);

0 commit comments

Comments
 (0)