8000 Use Unicode unconditionally for _winapi.CreateFile by zooba · Pull Request #114611 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

Use Unicode unconditionally for _winapi.CreateFile #114611

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions Modules/_winapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ _winapi_ConnectNamedPipe_impl(PyObject *module, HANDLE handle,
/*[clinic input]
_winapi.CreateFile -> HANDLE

file_name: LPCTSTR
file_name: LPCWSTR
desired_access: DWORD
share_mode: DWORD
security_attributes: LPSECURITY_ATTRIBUTES
Expand All @@ -452,12 +452,12 @@ _winapi.CreateFile -> HANDLE
[clinic start generated code]*/

static HANDLE
_winapi_CreateFile_impl(PyObject *module, LPCTSTR file_name,
_winapi_CreateFile_impl(PyObject *module, LPCWSTR file_name,
DWORD desired_access, DWORD share_mode,
LPSECURITY_ATTRIBUTES security_attributes,
DWORD creation_disposition,
DWORD flags_and_attributes, HANDLE template_file)
/*[clinic end generated code: output=417ddcebfc5a3d53 input=6423c3e40372dbd5]*/
/*[clinic end generated code: output=818c811e5e04d550 input=1fa870ed1c2e3d69]*/
{
HANDLE handle;

Expand All @@ -468,14 +468,15 @@ _winapi_CreateFile_impl(PyObject *module, LPCTSTR file_name,
}

Py_BEGIN_ALLOW_THREADS
handle = CreateFile(file_name, desired_access,
share_mode, security_attributes,
creation_disposition,
flags_and_attributes, template_file);
handle = CreateFileW(file_name, desired_access,
share_mode, security_attributes,
creation_disposition,
flags_and_attributes, template_file);
Py_END_ALLOW_THREADS

if (handle == INVALID_HANDLE_VALUE)
if (handle == INVALID_HANDLE_VALUE) {
PyErr_SetFromWindowsErr(0);
}

return handle;
}
Expand Down
13 changes: 8 additions & 5 deletions Modules/clinic/_winapi.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0