diff options
author | Zackery Spytz <zspytz@gmail.com> | 2019-05-30 07:58:50 (GMT) |
---|---|---|
committer | Victor Stinner <vstinner@redhat.com> | 2019-05-30 07:58:50 (GMT) |
commit | eda385c0dca62f97a8ae80feb57c2a51df3c807f (patch) | |
tree | cb402ff0ff9038cb30038a0ab85eebeaef2a827c /Modules | |
parent | bee31ce775ec70013d360b353572bd1a01d78e67 (diff) | |
download | cpython-eda385c0dca62f97a8ae80feb57c2a51df3c807f.zip cpython-eda385c0dca62f97a8ae80feb57c2a51df3c807f.tar.gz cpython-eda385c0dca62f97a8ae80feb57c2a51df3c807f.tar.bz2 |
bpo-36935: Remove usage of the deprecated PyErr_SetFromWindowsErrWithUnicodeFilename() (GH-13355)
In e895de3e7f3cc2f7213b87621cfe9812ea4343f0, the
deprecated function PyErr_SetFromWindowsErrWithUnicodeFilename() was
added in two functions in Modules/_winapi.c. This function was
deprecated in 3.3.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_winapi.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Modules/_winapi.c b/Modules/_winapi.c index 1317fc9..e9dcec6 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; } |