summaryrefslogtreecommitdiffstats
path: root/Python/errors.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-12-28 00:28:21 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-12-28 00:28:21 (GMT)
commit92be939695a43f039f3ef0d0d5fe55dc67607f70 (patch)
treecf750b1451b8a13650946ec62569ba95a985c64a /Python/errors.c
parent83098a4095a66b6562db88802fec5ea108414d58 (diff)
downloadcpython-92be939695a43f039f3ef0d0d5fe55dc67607f70.zip
cpython-92be939695a43f039f3ef0d0d5fe55dc67607f70.tar.gz
cpython-92be939695a43f039f3ef0d0d5fe55dc67607f70.tar.bz2
Issue #10780: PyErr_SetFromWindowsErrWithFilename() and
PyErr_SetExcFromWindowsErrWithFilename() decode the filename from the filesystem encoding instead of UTF-8.
Diffstat (limited to 'Python/errors.c')
-rw-r--r--Python/errors.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/errors.c b/Python/errors.c
index d5a6fae..5a9a624 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -515,7 +515,7 @@ PyObject *PyErr_SetExcFromWindowsErrWithFilename(
int ierr,
const char *filename)
{
- PyObject *name = filename ? PyUnicode_FromString(filename) : NULL;
+ PyObject *name = filename ? PyUnicode_DecodeFSDefault(filename) : NULL;
PyObject *ret = PyErr_SetExcFromWindowsErrWithFilenameObject(exc,
ierr,
name);
@@ -552,7 +552,7 @@ PyObject *PyErr_SetFromWindowsErrWithFilename(
int ierr,
const char *filename)
{
- PyObject *name = filename ? PyUnicode_FromString(filename) : NULL;
+ PyObject *name = filename ? PyUnicode_DecodeFSDefault(filename) : NULL;
PyObject *result = PyErr_SetExcFromWindowsErrWithFilenameObject(
PyExc_WindowsError,
ierr, name);