Skip to content

Commit 962c0d0

Browse files
author
mhammond
committed
Patch 594001: PEP 277 - Unicode file name support for Windows NT.
git-svn-id: http://svn.python.org/projects/python/trunk@28999 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent d3e6272 commit 962c0d0

File tree

6 files changed

+568
-44
lines changed

6 files changed

+568
-44
lines changed

Include/pyerrors.h

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,37 @@ PyAPI_DATA(PyObject *) PyExc_FutureWarning;
8181
PyAPI_FUNC(int) PyErr_BadArgument(void);
8282
PyAPI_FUNC(PyObject *) PyErr_NoMemory(void);
8383
PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *);
84+
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObject(
85+
PyObject *, PyObject *);
8486
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename(PyObject *, char *);
87+
#ifdef Py_WIN_WIDE_FILENAMES
88+
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename(
89+
PyObject *, Py_UNICODE *);
90+
#endif /* Py_WIN_WIDE_FILENAMES */
91+
8592
PyAPI_FUNC(PyObject *) PyErr_Format(PyObject *, const char *, ...)
8693
Py_GCC_ATTRIBUTE((format(printf, 2, 3)));
94+
8795
#ifdef MS_WINDOWS
88-
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename(int, const char *);
96+
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilenameObject(
97+
int, const char *);
98+
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename(
99+
int, const char *);
100+
#ifdef Py_WIN_WIDE_FILENAMES
101+
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithUnicodeFilename(
102+
int, const Py_UNICODE *);
103+
#endif /* Py_WIN_WIDE_FILENAMES */
89104
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErr(int);
105+
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObject(
106+
PyObject *,int, PyObject *);
90107
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilename(
91108
PyObject *,int, const char *);
109+
#ifdef Py_WIN_WIDE_FILENAMES
110+
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithUnicodeFilename(
111+
PyObject *,int, const Py_UNICODE *);
112+
#endif /* Py_WIN_WIDE_FILENAMES */
92113
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int);
93-
#endif
114+
#endif /* MS_WINDOWS */
94115

95116
/* Export the old function so that the existing API remains available: */
96117
PyAPI_FUNC(void) PyErr_BadInternalCall(void);

Lib/test/test_unicode_file.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@
4040
os.chmod(TESTFN_UNICODE, 0777)
4141

4242
# Test rename
43+
try:
44+
os.unlink(TESTFN_ENCODED + ".new")
45+
except os.error:
46+
pass
4347
os.rename(TESTFN_ENCODED, TESTFN_ENCODED + ".new")
4448
os.rename(TESTFN_UNICODE+".new", TESTFN_ENCODED)
4549

0 commit comments

Comments
 (0)