summaryrefslogtreecommitdiff
path: root/Modules/_winapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_winapi.c')
-rw-r--r--Modules/_winapi.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/Modules/_winapi.c b/Modules/_winapi.c
index 1317fc9a17..e9dcec6590 100644
--- a/Modules/_winapi.c
+++ b/Modules/_winapi.c
@@ -508,7 +508,9 @@ _winapi_CreateFileMapping_impl(PyObject *module, HANDLE file_handle,
Py_END_ALLOW_THREADS
if (handle == NULL) {
- PyErr_SetFromWindowsErrWithUnicodeFilename(0, name);
+ PyObject *temp = PyUnicode_FromWideChar(name, -1);
+ PyErr_SetExcFromWindowsErrWithFilenameObject(PyExc_OSError, 0, temp);
+ Py_XDECREF(temp);
handle = INVALID_HANDLE_VALUE;
}
@@ -1405,7 +1407,9 @@ _winapi_OpenFileMapping_impl(PyObject *module, DWORD desired_access,
Py_END_ALLOW_THREADS
if (handle == NULL) {
- PyErr_SetFromWindowsErrWithUnicodeFilename(0, name);
+ PyObject *temp = PyUnicode_FromWideChar(name, -1);
+ PyErr_SetExcFromWindowsErrWithFilenameObject(PyExc_OSError, 0, temp);
+ Py_XDECREF(temp);
handle = INVALID_HANDLE_VALUE;
}