Mercurial > cpython-lru_cache-weakref
diff Python/traceback.c @ 84750:82e9a9f8be3c 3.3
Check return value of PyObject_AsFileDescriptor() in _Py_DisplaySourceLine() for error
CID 486768
| author | Christian Heimes <christian@cheimes.de> |
|---|---|
| date | Sun, 21 Jul 2013 01:53:10 +0200 |
| parents | ff7fc6a91212 |
| children | 8fdb83492a58 19a8c3e36cfb |
line wrap: on
line diff
--- a/Python/traceback.c Sat Jul 20 22:54:25 2013 +0200 +++ b/Python/traceback.c Sun Jul 21 01:53:10 2013 +0200 @@ -255,6 +255,11 @@ /* use the right encoding to decode the file as unicode */ fd = PyObject_AsFileDescriptor(binary); + if (fd < 0) { + Py_DECREF(io); + Py_DECREF(binary); + return NULL; + } found_encoding = PyTokenizer_FindEncodingFilename(fd, filename); encoding = (found_encoding != NULL) ? found_encoding : "utf-8"; lseek(fd, 0, 0); /* Reset position */
