[issue25182] python -v crashes in nonencodable directory

STINNER Victor report at bugs.python.org
Wed Sep 30 14:59:05 CEST 2015


STINNER Victor added the comment:

> This is not related to this issue. sys.stderr uses backslashreplace.

Ok, fine.

---
+    _errno = errno;
     Py_END_ALLOW_THREADS
+    Py_XDECREF(bytes);

     if (n < 0) {
-        if (errno == EAGAIN)
+        if (_errno == EAGAIN)
             Py_RETURN_NONE;
         PyErr_SetFromErrno(PyExc_IOError);
---

Hum, if you expect that _errno can be modified by Py_XDECREF(bytes), you must restore the previous errno value before calling PyErr_SetFromErrno(). This strategy is used in Python/fileutils.c.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25182>
_______________________________________


More information about the Python-bugs-list mailing list