bpo-36346: Make using the legacy Unicode C API optional (GH-21437)

Add compile time option USE_UNICODE_WCHAR_CACHE. Setting it to 0
makes the interpreter not using the wchar_t cache and the legacy Unicode C API.
This commit is contained in:
Serhiy Storchaka 2020-07-10 23:26:06 +03:00 committed by GitHub
parent 9650fe0197
commit 4c8f09d7ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 360 additions and 99 deletions

View file

@ -164,10 +164,11 @@ create_converter('LPCVOID', '" F_POINTER "')
create_converter('BOOL', 'i') # F_BOOL used previously (always 'i')
create_converter('DWORD', 'k') # F_DWORD is always "k" (which is much shorter)
create_converter('LPCTSTR', 's')
create_converter('LPCWSTR', 'u')
create_converter('LPWSTR', 'u')
create_converter('UINT', 'I') # F_UINT used previously (always 'I')
class LPCWSTR_converter(Py_UNICODE_converter):
type = 'LPCWSTR'
class HANDLE_return_converter(CReturnConverter):
type = 'HANDLE'
@ -197,7 +198,7 @@ class LPVOID_return_converter(CReturnConverter):
data.return_conversion.append(
'return_value = HANDLE_TO_PYNUM(_return_value);\n')
[python start generated code]*/
/*[python end generated code: output=da39a3ee5e6b4b0d input=79464c61a31ae932]*/
/*[python end generated code: output=da39a3ee5e6b4b0d input=011ee0c3a2244bfe]*/
#include "clinic/_winapi.c.h"
@ -520,15 +521,15 @@ _winapi_CreateFileMapping_impl(PyObject *module, HANDLE file_handle,
/*[clinic input]
_winapi.CreateJunction
src_path: LPWSTR
dst_path: LPWSTR
src_path: LPCWSTR
dst_path: LPCWSTR
/
[clinic start generated code]*/
static PyObject *
_winapi_CreateJunction_impl(PyObject *module, LPWSTR src_path,
LPWSTR dst_path)
/*[clinic end generated code: output=66b7eb746e1dfa25 input=8cd1f9964b6e3d36]*/
_winapi_CreateJunction_impl(PyObject *module, LPCWSTR src_path,
LPCWSTR dst_path)
/*[clinic end generated code: output=44b3f5e9bbcc4271 input=963d29b44b9384a7]*/
{
/* Privilege adjustment */
HANDLE token = NULL;