[Python-checkins] cpython (3.3): let's not return NULL from functions that should return ints

benjamin.peterson python-checkins at python.org
Sun Jul 21 22:27:10 CEST 2013


http://hg.python.org/cpython/rev/34ca4dd47c54
changeset:   84766:34ca4dd47c54
branch:      3.3
parent:      84764:25ffad2e12d6
user:        Benjamin Peterson <benjamin at python.org>
date:        Sun Jul 21 13:26:13 2013 -0700
summary:
  let's not return NULL from functions that should return ints

files:
  Python/traceback.c |  4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/Python/traceback.c b/Python/traceback.c
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -258,7 +258,7 @@
     if (fd < 0) {
         Py_DECREF(io);
         Py_DECREF(binary);
-        return NULL;
+        return 0;
     }
     found_encoding = PyTokenizer_FindEncodingFilename(fd, filename);
     encoding = (found_encoding != NULL) ? found_encoding : "utf-8";
@@ -267,7 +267,7 @@
         Py_DECREF(io);
         Py_DECREF(binary);
         PyMem_FREE(found_encoding);
-        return PyErr_SetFromErrnoWithFilenameObject(PyExc_IOError, filename);
+        return 0;
     }
     fob = _PyObject_CallMethodId(io, &PyId_TextIOWrapper, "Os", binary, encoding);
     Py_DECREF(io);

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list