File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -219,8 +219,9 @@ in various ways. There is a separate error indicator for each thread.
219219
220220 Similar to :c:func: `PyErr_SetFromWindowsErr `, with the additional behavior that
221221 if *filename * is not *NULL *, it is passed to the constructor of
222- :exc: `WindowsError ` as a third parameter. *filename * is decoded from UTF-8.
223- Availability: Windows.
222+ :exc: `WindowsError ` as a third parameter. *filename * is decoded from the
223+ filesystem encoding (:func: `sys.getfilesystemencoding `). Availability:
224+ Windows.
224225
225226
226227.. c:function:: PyObject* PyErr_SetExcFromWindowsErrWithFilename(PyObject *type, int ierr, char *filename)
Original file line number Diff line number Diff line change @@ -202,7 +202,7 @@ PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilenameObject(
202202 int , const char * );
203203PyAPI_FUNC (PyObject * ) PyErr_SetFromWindowsErrWithFilename (
204204 int ierr ,
205- const char * filename /* decoded from UTF-8 */
205+ const char * filename , /* decoded from the filesystem encoding */
206206 );
207207#ifndef Py_LIMITED_API
208208/* XXX redeclare to use WSTRING */
@@ -215,7 +215,7 @@ PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObject(
215215PyAPI_FUNC (PyObject * ) PyErr_SetExcFromWindowsErrWithFilename (
216216 PyObject * exc ,
217217 int ierr ,
218- const char * filename /* decoded from UTF-8 */
218+ const char * filename , /* decoded from the filesystem encoding */
219219 );
220220#ifndef Py_LIMITED_API
221221PyAPI_FUNC (PyObject * ) PyErr_SetExcFromWindowsErrWithUnicodeFilename (
Original file line number Diff line number Diff line change @@ -8,6 +8,10 @@ What's New in Python 3.2 Release Candidate 1
88Core and Builtins
99-----------------
1010
11+ - Issue #10780: PyErr_SetFromWindowsErrWithFilename() and
12+ PyErr_SetExcFromWindowsErrWithFilename() decode the filename from the
13+ filesystem encoding instead of UTF-8.
14+
1115- Issue #10779: PyErr_WarnExplicit() decodes the filename from the filesystem
1216 encoding instead of UTF-8.
1317
Original file line number Diff line number Diff line change @@ -515,7 +515,7 @@ PyObject *PyErr_SetExcFromWindowsErrWithFilename(
515515 int ierr ,
516516 const char * filename )
517517{
518- PyObject * name = filename ? PyUnicode_FromString (filename ) : NULL ;
518+ PyObject * name = filename ? PyUnicode_DecodeFSDefault (filename ) : NULL ;
519519 PyObject * ret = PyErr_SetExcFromWindowsErrWithFilenameObject (exc ,
520520 ierr ,
521521 name );
@@ -552,7 +552,7 @@ PyObject *PyErr_SetFromWindowsErrWithFilename(
552552 int ierr ,
553553 const char * filename )
554554{
555- PyObject * name = filename ? PyUnicode_FromString (filename ) : NULL ;
555+ PyObject * name = filename ? PyUnicode_DecodeFSDefault (filename ) : NULL ;
556556 PyObject * result = PyErr_SetExcFromWindowsErrWithFilenameObject (
557557 PyExc_WindowsError ,
558558 ierr , name );
You can’t perform that action at this time.
0 commit comments