mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
posix_error_with_allocated_filename() decodes the filename with
PyUnicode_DecodeFSDefaultAndSize() and call PyErr_SetFromErrnoWithFilenameObject() instead of PyErr_SetFromErrnoWithFilename()
This commit is contained in:
parent
8d93e49a93
commit
77ccd6d0c7
1 changed files with 6 additions and 2 deletions
|
@ -559,9 +559,13 @@ posix_error_with_unicode_filename(Py_UNICODE* name)
|
|||
static PyObject *
|
||||
posix_error_with_allocated_filename(PyObject* name)
|
||||
{
|
||||
PyObject *rc = PyErr_SetFromErrnoWithFilename(PyExc_OSError,
|
||||
PyBytes_AsString(name));
|
||||
PyObject *name_str, *rc;
|
||||
name_str = PyUnicode_DecodeFSDefaultAndSize(PyBytes_AsString(name),
|
||||
PyBytes_GET_SIZE(name));
|
||||
Py_DECREF(name);
|
||||
rc = PyErr_SetFromErrnoWithFilenameObject(PyExc_OSError,
|
||||
name_str);
|
||||
Py_XDECREF(name_str);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue