Skip to content

Commit

Permalink
bpo-36935: Remove usage of the deprecated PyErr_SetFromWindowsErrWith…
Browse files Browse the repository at this point in the history
…UnicodeFilename() (pythonGH-13355)

In e895de3, the
deprecated function PyErr_SetFromWindowsErrWithUnicodeFilename() was
added in two functions in Modules/_winapi.c. This function was
deprecated in 3.3.
  • Loading branch information
ZackerySpytz authored and vstinner committed May 30, 2019
1 parent bee31ce commit eda385c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Modules/_winapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit eda385c

Please sign in to comment.