diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-05-08 00:36:42 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-05-08 00:36:42 (GMT) |
commit | 77ccd6d0c7420c4a1323f7e781d766a611723bed (patch) | |
tree | f314c9c929e77082e2abbf5bbc1342b6a8e984fb /Modules | |
parent | 8d93e49a93fbea491cd3e9598bc1f308b52a9366 (diff) | |
download | cpython-77ccd6d0c7420c4a1323f7e781d766a611723bed.zip cpython-77ccd6d0c7420c4a1323f7e781d766a611723bed.tar.gz cpython-77ccd6d0c7420c4a1323f7e781d766a611723bed.tar.bz2 |
posix_error_with_allocated_filename() decodes the filename with
PyUnicode_DecodeFSDefaultAndSize() and call
PyErr_SetFromErrnoWithFilenameObject() instead of
PyErr_SetFromErrnoWithFilename()
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/posixmodule.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index a48f233..8aea640 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -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; } |