mirror of https://github.com/python/cpython
os.listdir(): Fall back to the original byte string if conversion to unicode
fails, as discussed in patch #683592.
This commit is contained in:
parent
69700ef573
commit
6a42183967
|
@ -1809,12 +1809,14 @@ posix_listdir(PyObject *self, PyObject *args)
|
||||||
w = PyUnicode_FromEncodedObject(v,
|
w = PyUnicode_FromEncodedObject(v,
|
||||||
Py_FileSystemDefaultEncoding,
|
Py_FileSystemDefaultEncoding,
|
||||||
"strict");
|
"strict");
|
||||||
|
if (w != NULL) {
|
||||||
Py_DECREF(v);
|
Py_DECREF(v);
|
||||||
v = w;
|
v = w;
|
||||||
if (v == NULL) {
|
}
|
||||||
Py_DECREF(d);
|
else {
|
||||||
d = NULL;
|
/* fall back to the original byte string, as
|
||||||
break;
|
discussed in patch #683592 */
|
||||||
|
PyErr_Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue