bpo-35489: Use "const Py_UNICODE *" for the Py_UNICODE converter in AC. (GH-11150)

This commit is contained in:
Serhiy Storchaka 2018-12-14 11:19:51 +02:00 committed by GitHub
parent 7b36016a15
commit afb3e71a17
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 110 additions and 98 deletions

View file

@ -995,13 +995,14 @@ process ID, and thread ID.
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
_winapi_CreateProcess_impl(PyObject *module, Py_UNICODE *application_name, _winapi_CreateProcess_impl(PyObject *module,
const Py_UNICODE *application_name,
PyObject *command_line, PyObject *proc_attrs, PyObject *command_line, PyObject *proc_attrs,
PyObject *thread_attrs, BOOL inherit_handles, PyObject *thread_attrs, BOOL inherit_handles,
DWORD creation_flags, PyObject *env_mapping, DWORD creation_flags, PyObject *env_mapping,
Py_UNICODE *current_directory, const Py_UNICODE *current_directory,
PyObject *startup_info) PyObject *startup_info)
/*[clinic end generated code: output=2ecaab46a05e3123 input=42ac293eaea03fc4]*/ /*[clinic end generated code: output=9b2423a609230132 input=42ac293eaea03fc4]*/
{ {
PyObject *ret = NULL; PyObject *ret = NULL;
BOOL result; BOOL result;

View file

@ -1712,9 +1712,9 @@ some other type.
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
array_array_fromunicode_impl(arrayobject *self, Py_UNICODE *ustr, array_array_fromunicode_impl(arrayobject *self, const Py_UNICODE *ustr,
Py_ssize_clean_t ustr_length) Py_ssize_clean_t ustr_length)
/*[clinic end generated code: output=ebb72fc16975e06d input=150f00566ffbca6e]*/ /*[clinic end generated code: output=cf2f662908e2befc input=150f00566ffbca6e]*/
{ {
char typecode; char typecode;

View file

@ -300,25 +300,26 @@ PyDoc_STRVAR(_winapi_CreateProcess__doc__,
{"CreateProcess", (PyCFunction)(void(*)(void))_winapi_CreateProcess, METH_FASTCALL, _winapi_CreateProcess__doc__}, {"CreateProcess", (PyCFunction)(void(*)(void))_winapi_CreateProcess, METH_FASTCALL, _winapi_CreateProcess__doc__},
static PyObject * static PyObject *
_winapi_CreateProcess_impl(PyObject *module, Py_UNICODE *application_name, _winapi_CreateProcess_impl(PyObject *module,
const Py_UNICODE *application_name,
PyObject *command_line, PyObject *proc_attrs, PyObject *command_line, PyObject *proc_attrs,
PyObject *thread_attrs, BOOL inherit_handles, PyObject *thread_attrs, BOOL inherit_handles,
DWORD creation_flags, PyObject *env_mapping, DWORD creation_flags, PyObject *env_mapping,
Py_UNICODE *current_directory, const Py_UNICODE *current_directory,
PyObject *startup_info); PyObject *startup_info);
static PyObject * static PyObject *
_winapi_CreateProcess(PyObject *module, PyObject *const *args, Py_ssize_t nargs) _winapi_CreateProcess(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{ {
PyObject *return_value = NULL; PyObject *return_value = NULL;
Py_UNICODE *application_name; const Py_UNICODE *application_name;
PyObject *command_line; PyObject *command_line;
PyObject *proc_attrs; PyObject *proc_attrs;
PyObject *thread_attrs; PyObject *thread_attrs;
BOOL inherit_handles; BOOL inherit_handles;
DWORD creation_flags; DWORD creation_flags;
PyObject *env_mapping; PyObject *env_mapping;
Py_UNICODE *current_directory; const Py_UNICODE *current_directory;
PyObject *startup_info; PyObject *startup_info;
if (!_PyArg_ParseStack(args, nargs, "ZOOOikOZO:CreateProcess", if (!_PyArg_ParseStack(args, nargs, "ZOOOikOZO:CreateProcess",
@ -943,4 +944,4 @@ _winapi_GetFileType(PyObject *module, PyObject *const *args, Py_ssize_t nargs, P
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=1568ad4bd625f2af input=a9049054013a1b77]*/ /*[clinic end generated code: output=145d0d362167c1b1 input=a9049054013a1b77]*/

View file

@ -376,14 +376,14 @@ PyDoc_STRVAR(array_array_fromunicode__doc__,
{"fromunicode", (PyCFunction)array_array_fromunicode, METH_O, array_array_fromunicode__doc__}, {"fromunicode", (PyCFunction)array_array_fromunicode, METH_O, array_array_fromunicode__doc__},
static PyObject * static PyObject *
array_array_fromunicode_impl(arrayobject *self, Py_UNICODE *ustr, array_array_fromunicode_impl(arrayobject *self, const Py_UNICODE *ustr,
Py_ssize_clean_t ustr_length); Py_ssize_clean_t ustr_length);
static PyObject * static PyObject *
array_array_fromunicode(arrayobject *self, PyObject *arg) array_array_fromunicode(arrayobject *self, PyObject *arg)
{ {
PyObject *return_value = NULL; PyObject *return_value = NULL;
Py_UNICODE *ustr; const Py_UNICODE *ustr;
Py_ssize_clean_t ustr_length; Py_ssize_clean_t ustr_length;
if (!PyArg_Parse(arg, "u#:fromunicode", &ustr, &ustr_length)) { if (!PyArg_Parse(arg, "u#:fromunicode", &ustr, &ustr_length)) {
@ -505,4 +505,4 @@ PyDoc_STRVAR(array_arrayiterator___setstate____doc__,
#define ARRAY_ARRAYITERATOR___SETSTATE___METHODDEF \ #define ARRAY_ARRAYITERATOR___SETSTATE___METHODDEF \
{"__setstate__", (PyCFunction)array_arrayiterator___setstate__, METH_O, array_arrayiterator___setstate____doc__}, {"__setstate__", (PyCFunction)array_arrayiterator___setstate__, METH_O, array_arrayiterator___setstate____doc__},
/*[clinic end generated code: output=3a4c6f3deb597bfd input=a9049054013a1b77]*/ /*[clinic end generated code: output=3d2bb1aa81541cbd input=a9049054013a1b77]*/

View file

@ -1329,7 +1329,7 @@ PyDoc_STRVAR(os_system__doc__,
{"system", (PyCFunction)(void(*)(void))os_system, METH_FASTCALL|METH_KEYWORDS, os_system__doc__}, {"system", (PyCFunction)(void(*)(void))os_system, METH_FASTCALL|METH_KEYWORDS, os_system__doc__},
static long static long
os_system_impl(PyObject *module, Py_UNICODE *command); os_system_impl(PyObject *module, const Py_UNICODE *command);
static PyObject * static PyObject *
os_system(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) os_system(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
@ -1337,7 +1337,7 @@ os_system(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *k
PyObject *return_value = NULL; PyObject *return_value = NULL;
static const char * const _keywords[] = {"command", NULL}; static const char * const _keywords[] = {"command", NULL};
static _PyArg_Parser _parser = {"u:system", _keywords, 0}; static _PyArg_Parser _parser = {"u:system", _keywords, 0};
Py_UNICODE *command; const Py_UNICODE *command;
long _return_value; long _return_value;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
@ -5327,7 +5327,8 @@ PyDoc_STRVAR(os_startfile__doc__,
{"startfile", (PyCFunction)(void(*)(void))os_startfile, METH_FASTCALL|METH_KEYWORDS, os_startfile__doc__}, {"startfile", (PyCFunction)(void(*)(void))os_startfile, METH_FASTCALL|METH_KEYWORDS, os_startfile__doc__},
static PyObject * static PyObject *
os_startfile_impl(PyObject *module, path_t *filepath, Py_UNICODE *operation); os_startfile_impl(PyObject *module, path_t *filepath,
const Py_UNICODE *operation);
static PyObject * static PyObject *
os_startfile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) os_startfile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
@ -5336,7 +5337,7 @@ os_startfile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
static const char * const _keywords[] = {"filepath", "operation", NULL}; static const char * const _keywords[] = {"filepath", "operation", NULL};
static _PyArg_Parser _parser = {"O&|u:startfile", _keywords, 0}; static _PyArg_Parser _parser = {"O&|u:startfile", _keywords, 0};
path_t filepath = PATH_T_INITIALIZE("startfile", "filepath", 0, 0); path_t filepath = PATH_T_INITIALIZE("startfile", "filepath", 0, 0);
Py_UNICODE *operation = NULL; const Py_UNICODE *operation = NULL;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
path_converter, &filepath, &operation)) { path_converter, &filepath, &operation)) {
@ -6757,4 +6758,4 @@ exit:
#ifndef OS_GETRANDOM_METHODDEF #ifndef OS_GETRANDOM_METHODDEF
#define OS_GETRANDOM_METHODDEF #define OS_GETRANDOM_METHODDEF
#endif /* !defined(OS_GETRANDOM_METHODDEF) */ #endif /* !defined(OS_GETRANDOM_METHODDEF) */
/*[clinic end generated code: output=d62c0bb988141e70 input=a9049054013a1b77]*/ /*[clinic end generated code: output=7ebb53d872bab149 input=a9049054013a1b77]*/

View file

@ -4215,8 +4215,8 @@ Execute the command in a subshell.
[clinic start generated code]*/ [clinic start generated code]*/
static long static long
os_system_impl(PyObject *module, Py_UNICODE *command) os_system_impl(PyObject *module, const Py_UNICODE *command)
/*[clinic end generated code: output=96c4dffee36dfb48 input=303f5ce97df606b0]*/ /*[clinic end generated code: output=5b7c3599c068ca42 input=303f5ce97df606b0]*/
{ {
long result; long result;
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
@ -11224,8 +11224,9 @@ the underlying Win32 ShellExecute function doesn't work if it is.
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
os_startfile_impl(PyObject *module, path_t *filepath, Py_UNICODE *operation) os_startfile_impl(PyObject *module, path_t *filepath,
/*[clinic end generated code: output=912ceba79acfa1c9 input=63950bf2986380d0]*/ const Py_UNICODE *operation)
/*[clinic end generated code: output=66dc311c94d50797 input=63950bf2986380d0]*/
{ {
HINSTANCE rc; HINSTANCE rc;

82
PC/clinic/winreg.c.h generated
View file

@ -137,14 +137,14 @@ PyDoc_STRVAR(winreg_ConnectRegistry__doc__,
{"ConnectRegistry", (PyCFunction)(void(*)(void))winreg_ConnectRegistry, METH_FASTCALL, winreg_ConnectRegistry__doc__}, {"ConnectRegistry", (PyCFunction)(void(*)(void))winreg_ConnectRegistry, METH_FASTCALL, winreg_ConnectRegistry__doc__},
static HKEY static HKEY
winreg_ConnectRegistry_impl(PyObject *module, Py_UNICODE *computer_name, winreg_ConnectRegistry_impl(PyObject *module,
HKEY key); const Py_UNICODE *computer_name, HKEY key);
static PyObject * static PyObject *
winreg_ConnectRegistry(PyObject *module, PyObject *const *args, Py_ssize_t nargs) winreg_ConnectRegistry(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{ {
PyObject *return_value = NULL; PyObject *return_value = NULL;
Py_UNICODE *computer_name; const Py_UNICODE *computer_name;
HKEY key; HKEY key;
HKEY _return_value; HKEY _return_value;
@ -185,14 +185,14 @@ PyDoc_STRVAR(winreg_CreateKey__doc__,
{"CreateKey", (PyCFunction)(void(*)(void))winreg_CreateKey, METH_FASTCALL, winreg_CreateKey__doc__}, {"CreateKey", (PyCFunction)(void(*)(void))winreg_CreateKey, METH_FASTCALL, winreg_CreateKey__doc__},
static HKEY static HKEY
winreg_CreateKey_impl(PyObject *module, HKEY key, Py_UNICODE *sub_key); winreg_CreateKey_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key);
static PyObject * static PyObject *
winreg_CreateKey(PyObject *module, PyObject *const *args, Py_ssize_t nargs) winreg_CreateKey(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{ {
PyObject *return_value = NULL; PyObject *return_value = NULL;
HKEY key; HKEY key;
Py_UNICODE *sub_key; const Py_UNICODE *sub_key;
HKEY _return_value; HKEY _return_value;
if (!_PyArg_ParseStack(args, nargs, "O&Z:CreateKey", if (!_PyArg_ParseStack(args, nargs, "O&Z:CreateKey",
@ -238,8 +238,9 @@ PyDoc_STRVAR(winreg_CreateKeyEx__doc__,
{"CreateKeyEx", (PyCFunction)(void(*)(void))winreg_CreateKeyEx, METH_FASTCALL|METH_KEYWORDS, winreg_CreateKeyEx__doc__}, {"CreateKeyEx", (PyCFunction)(void(*)(void))winreg_CreateKeyEx, METH_FASTCALL|METH_KEYWORDS, winreg_CreateKeyEx__doc__},
static HKEY static HKEY
winreg_CreateKeyEx_impl(PyObject *module, HKEY key, Py_UNICODE *sub_key, winreg_CreateKeyEx_impl(PyObject *module, HKEY key,
int reserved, REGSAM access); const Py_UNICODE *sub_key, int reserved,
REGSAM access);
static PyObject * static PyObject *
winreg_CreateKeyEx(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) winreg_CreateKeyEx(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
@ -248,7 +249,7 @@ winreg_CreateKeyEx(PyObject *module, PyObject *const *args, Py_ssize_t nargs, Py
static const char * const _keywords[] = {"key", "sub_key", "reserved", "access", NULL}; static const char * const _keywords[] = {"key", "sub_key", "reserved", "access", NULL};
static _PyArg_Parser _parser = {"O&Z|ii:CreateKeyEx", _keywords, 0}; static _PyArg_Parser _parser = {"O&Z|ii:CreateKeyEx", _keywords, 0};
HKEY key; HKEY key;
Py_UNICODE *sub_key; const Py_UNICODE *sub_key;
int reserved = 0; int reserved = 0;
REGSAM access = KEY_WRITE; REGSAM access = KEY_WRITE;
HKEY _return_value; HKEY _return_value;
@ -289,14 +290,14 @@ PyDoc_STRVAR(winreg_DeleteKey__doc__,
{"DeleteKey", (PyCFunction)(void(*)(void))winreg_DeleteKey, METH_FASTCALL, winreg_DeleteKey__doc__}, {"DeleteKey", (PyCFunction)(void(*)(void))winreg_DeleteKey, METH_FASTCALL, winreg_DeleteKey__doc__},
static PyObject * static PyObject *
winreg_DeleteKey_impl(PyObject *module, HKEY key, Py_UNICODE *sub_key); winreg_DeleteKey_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key);
static PyObject * static PyObject *
winreg_DeleteKey(PyObject *module, PyObject *const *args, Py_ssize_t nargs) winreg_DeleteKey(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{ {
PyObject *return_value = NULL; PyObject *return_value = NULL;
HKEY key; HKEY key;
Py_UNICODE *sub_key; const Py_UNICODE *sub_key;
if (!_PyArg_ParseStack(args, nargs, "O&u:DeleteKey", if (!_PyArg_ParseStack(args, nargs, "O&u:DeleteKey",
clinic_HKEY_converter, &key, &sub_key)) { clinic_HKEY_converter, &key, &sub_key)) {
@ -337,8 +338,9 @@ PyDoc_STRVAR(winreg_DeleteKeyEx__doc__,
{"DeleteKeyEx", (PyCFunction)(void(*)(void))winreg_DeleteKeyEx, METH_FASTCALL|METH_KEYWORDS, winreg_DeleteKeyEx__doc__}, {"DeleteKeyEx", (PyCFunction)(void(*)(void))winreg_DeleteKeyEx, METH_FASTCALL|METH_KEYWORDS, winreg_DeleteKeyEx__doc__},
static PyObject * static PyObject *
winreg_DeleteKeyEx_impl(PyObject *module, HKEY key, Py_UNICODE *sub_key, winreg_DeleteKeyEx_impl(PyObject *module, HKEY key,
REGSAM access, int reserved); const Py_UNICODE *sub_key, REGSAM access,
int reserved);
static PyObject * static PyObject *
winreg_DeleteKeyEx(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) winreg_DeleteKeyEx(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
@ -347,7 +349,7 @@ winreg_DeleteKeyEx(PyObject *module, PyObject *const *args, Py_ssize_t nargs, Py
static const char * const _keywords[] = {"key", "sub_key", "access", "reserved", NULL}; static const char * const _keywords[] = {"key", "sub_key", "access", "reserved", NULL};
static _PyArg_Parser _parser = {"O&u|ii:DeleteKeyEx", _keywords, 0}; static _PyArg_Parser _parser = {"O&u|ii:DeleteKeyEx", _keywords, 0};
HKEY key; HKEY key;
Py_UNICODE *sub_key; const Py_UNICODE *sub_key;
REGSAM access = KEY_WOW64_64KEY; REGSAM access = KEY_WOW64_64KEY;
int reserved = 0; int reserved = 0;
@ -376,14 +378,14 @@ PyDoc_STRVAR(winreg_DeleteValue__doc__,
{"DeleteValue", (PyCFunction)(void(*)(void))winreg_DeleteValue, METH_FASTCALL, winreg_DeleteValue__doc__}, {"DeleteValue", (PyCFunction)(void(*)(void))winreg_DeleteValue, METH_FASTCALL, winreg_DeleteValue__doc__},
static PyObject * static PyObject *
winreg_DeleteValue_impl(PyObject *module, HKEY key, Py_UNICODE *value); winreg_DeleteValue_impl(PyObject *module, HKEY key, const Py_UNICODE *value);
static PyObject * static PyObject *
winreg_DeleteValue(PyObject *module, PyObject *const *args, Py_ssize_t nargs) winreg_DeleteValue(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{ {
PyObject *return_value = NULL; PyObject *return_value = NULL;
HKEY key; HKEY key;
Py_UNICODE *value; const Py_UNICODE *value;
if (!_PyArg_ParseStack(args, nargs, "O&Z:DeleteValue", if (!_PyArg_ParseStack(args, nargs, "O&Z:DeleteValue",
clinic_HKEY_converter, &key, &value)) { clinic_HKEY_converter, &key, &value)) {
@ -490,13 +492,14 @@ PyDoc_STRVAR(winreg_ExpandEnvironmentStrings__doc__,
{"ExpandEnvironmentStrings", (PyCFunction)winreg_ExpandEnvironmentStrings, METH_O, winreg_ExpandEnvironmentStrings__doc__}, {"ExpandEnvironmentStrings", (PyCFunction)winreg_ExpandEnvironmentStrings, METH_O, winreg_ExpandEnvironmentStrings__doc__},
static PyObject * static PyObject *
winreg_ExpandEnvironmentStrings_impl(PyObject *module, Py_UNICODE *string); winreg_ExpandEnvironmentStrings_impl(PyObject *module,
const Py_UNICODE *string);
static PyObject * static PyObject *
winreg_ExpandEnvironmentStrings(PyObject *module, PyObject *arg) winreg_ExpandEnvironmentStrings(PyObject *module, PyObject *arg)
{ {
PyObject *return_value = NULL; PyObject *return_value = NULL;
Py_UNICODE *string; const Py_UNICODE *string;
if (!PyArg_Parse(arg, "u:ExpandEnvironmentStrings", &string)) { if (!PyArg_Parse(arg, "u:ExpandEnvironmentStrings", &string)) {
goto exit; goto exit;
@ -579,16 +582,16 @@ PyDoc_STRVAR(winreg_LoadKey__doc__,
{"LoadKey", (PyCFunction)(void(*)(void))winreg_LoadKey, METH_FASTCALL, winreg_LoadKey__doc__}, {"LoadKey", (PyCFunction)(void(*)(void))winreg_LoadKey, METH_FASTCALL, winreg_LoadKey__doc__},
static PyObject * static PyObject *
winreg_LoadKey_impl(PyObject *module, HKEY key, Py_UNICODE *sub_key, winreg_LoadKey_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key,
Py_UNICODE *file_name); const Py_UNICODE *file_name);
static PyObject * static PyObject *
winreg_LoadKey(PyObject *module, PyObject *const *args, Py_ssize_t nargs) winreg_LoadKey(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{ {
PyObject *return_value = NULL; PyObject *return_value = NULL;
HKEY key; HKEY key;
Py_UNICODE *sub_key; const Py_UNICODE *sub_key;
Py_UNICODE *file_name; const Py_UNICODE *file_name;
if (!_PyArg_ParseStack(args, nargs, "O&uu:LoadKey", if (!_PyArg_ParseStack(args, nargs, "O&uu:LoadKey",
clinic_HKEY_converter, &key, &sub_key, &file_name)) { clinic_HKEY_converter, &key, &sub_key, &file_name)) {
@ -623,7 +626,7 @@ PyDoc_STRVAR(winreg_OpenKey__doc__,
{"OpenKey", (PyCFunction)(void(*)(void))winreg_OpenKey, METH_FASTCALL|METH_KEYWORDS, winreg_OpenKey__doc__}, {"OpenKey", (PyCFunction)(void(*)(void))winreg_OpenKey, METH_FASTCALL|METH_KEYWORDS, winreg_OpenKey__doc__},
static HKEY static HKEY
winreg_OpenKey_impl(PyObject *module, HKEY key, Py_UNICODE *sub_key, winreg_OpenKey_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key,
int reserved, REGSAM access); int reserved, REGSAM access);
static PyObject * static PyObject *
@ -633,7 +636,7 @@ winreg_OpenKey(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
static const char * const _keywords[] = {"key", "sub_key", "reserved", "access", NULL}; static const char * const _keywords[] = {"key", "sub_key", "reserved", "access", NULL};
static _PyArg_Parser _parser = {"O&Z|ii:OpenKey", _keywords, 0}; static _PyArg_Parser _parser = {"O&Z|ii:OpenKey", _keywords, 0};
HKEY key; HKEY key;
Py_UNICODE *sub_key; const Py_UNICODE *sub_key;
int reserved = 0; int reserved = 0;
REGSAM access = KEY_READ; REGSAM access = KEY_READ;
HKEY _return_value; HKEY _return_value;
@ -675,7 +678,7 @@ PyDoc_STRVAR(winreg_OpenKeyEx__doc__,
{"OpenKeyEx", (PyCFunction)(void(*)(void))winreg_OpenKeyEx, METH_FASTCALL|METH_KEYWORDS, winreg_OpenKeyEx__doc__}, {"OpenKeyEx", (PyCFunction)(void(*)(void))winreg_OpenKeyEx, METH_FASTCALL|METH_KEYWORDS, winreg_OpenKeyEx__doc__},
static HKEY static HKEY
winreg_OpenKeyEx_impl(PyObject *module, HKEY key, Py_UNICODE *sub_key, winreg_OpenKeyEx_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key,
int reserved, REGSAM access); int reserved, REGSAM access);
static PyObject * static PyObject *
@ -685,7 +688,7 @@ winreg_OpenKeyEx(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
static const char * const _keywords[] = {"key", "sub_key", "reserved", "access", NULL}; static const char * const _keywords[] = {"key", "sub_key", "reserved", "access", NULL};
static _PyArg_Parser _parser = {"O&Z|ii:OpenKeyEx", _keywords, 0}; static _PyArg_Parser _parser = {"O&Z|ii:OpenKeyEx", _keywords, 0};
HKEY key; HKEY key;
Py_UNICODE *sub_key; const Py_UNICODE *sub_key;
int reserved = 0; int reserved = 0;
REGSAM access = KEY_READ; REGSAM access = KEY_READ;
HKEY _return_value; HKEY _return_value;
@ -764,14 +767,14 @@ PyDoc_STRVAR(winreg_QueryValue__doc__,
{"QueryValue", (PyCFunction)(void(*)(void))winreg_QueryValue, METH_FASTCALL, winreg_QueryValue__doc__}, {"QueryValue", (PyCFunction)(void(*)(void))winreg_QueryValue, METH_FASTCALL, winreg_QueryValue__doc__},
static PyObject * static PyObject *
winreg_QueryValue_impl(PyObject *module, HKEY key, Py_UNICODE *sub_key); winreg_QueryValue_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key);
static PyObject * static PyObject *
winreg_QueryValue(PyObject *module, PyObject *const *args, Py_ssize_t nargs) winreg_QueryValue(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{ {
PyObject *return_value = NULL; PyObject *return_value = NULL;
HKEY key; HKEY key;
Py_UNICODE *sub_key; const Py_UNICODE *sub_key;
if (!_PyArg_ParseStack(args, nargs, "O&Z:QueryValue", if (!_PyArg_ParseStack(args, nargs, "O&Z:QueryValue",
clinic_HKEY_converter, &key, &sub_key)) { clinic_HKEY_converter, &key, &sub_key)) {
@ -803,14 +806,14 @@ PyDoc_STRVAR(winreg_QueryValueEx__doc__,
{"QueryValueEx", (PyCFunction)(void(*)(void))winreg_QueryValueEx, METH_FASTCALL, winreg_QueryValueEx__doc__}, {"QueryValueEx", (PyCFunction)(void(*)(void))winreg_QueryValueEx, METH_FASTCALL, winreg_QueryValueEx__doc__},
static PyObject * static PyObject *
winreg_QueryValueEx_impl(PyObject *module, HKEY key, Py_UNICODE *name); winreg_QueryValueEx_impl(PyObject *module, HKEY key, const Py_UNICODE *name);
static PyObject * static PyObject *
winreg_QueryValueEx(PyObject *module, PyObject *const *args, Py_ssize_t nargs) winreg_QueryValueEx(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{ {
PyObject *return_value = NULL; PyObject *return_value = NULL;
HKEY key; HKEY key;
Py_UNICODE *name; const Py_UNICODE *name;
if (!_PyArg_ParseStack(args, nargs, "O&Z:QueryValueEx", if (!_PyArg_ParseStack(args, nargs, "O&Z:QueryValueEx",
clinic_HKEY_converter, &key, &name)) { clinic_HKEY_converter, &key, &name)) {
@ -847,14 +850,14 @@ PyDoc_STRVAR(winreg_SaveKey__doc__,
{"SaveKey", (PyCFunction)(void(*)(void))winreg_SaveKey, METH_FASTCALL, winreg_SaveKey__doc__}, {"SaveKey", (PyCFunction)(void(*)(void))winreg_SaveKey, METH_FASTCALL, winreg_SaveKey__doc__},
static PyObject * static PyObject *
winreg_SaveKey_impl(PyObject *module, HKEY key, Py_UNICODE *file_name); winreg_SaveKey_impl(PyObject *module, HKEY key, const Py_UNICODE *file_name);
static PyObject * static PyObject *
winreg_SaveKey(PyObject *module, PyObject *const *args, Py_ssize_t nargs) winreg_SaveKey(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{ {
PyObject *return_value = NULL; PyObject *return_value = NULL;
HKEY key; HKEY key;
Py_UNICODE *file_name; const Py_UNICODE *file_name;
if (!_PyArg_ParseStack(args, nargs, "O&u:SaveKey", if (!_PyArg_ParseStack(args, nargs, "O&u:SaveKey",
clinic_HKEY_converter, &key, &file_name)) { clinic_HKEY_converter, &key, &file_name)) {
@ -896,8 +899,8 @@ PyDoc_STRVAR(winreg_SetValue__doc__,
{"SetValue", (PyCFunction)(void(*)(void))winreg_SetValue, METH_FASTCALL, winreg_SetValue__doc__}, {"SetValue", (PyCFunction)(void(*)(void))winreg_SetValue, METH_FASTCALL, winreg_SetValue__doc__},
static PyObject * static PyObject *
winreg_SetValue_impl(PyObject *module, HKEY key, Py_UNICODE *sub_key, winreg_SetValue_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key,
DWORD type, Py_UNICODE *value, DWORD type, const Py_UNICODE *value,
Py_ssize_clean_t value_length); Py_ssize_clean_t value_length);
static PyObject * static PyObject *
@ -905,9 +908,9 @@ winreg_SetValue(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{ {
PyObject *return_value = NULL; PyObject *return_value = NULL;
HKEY key; HKEY key;
Py_UNICODE *sub_key; const Py_UNICODE *sub_key;
DWORD type; DWORD type;
Py_UNICODE *value; const Py_UNICODE *value;
Py_ssize_clean_t value_length; Py_ssize_clean_t value_length;
if (!_PyArg_ParseStack(args, nargs, "O&Zku#:SetValue", if (!_PyArg_ParseStack(args, nargs, "O&Zku#:SetValue",
@ -967,15 +970,16 @@ PyDoc_STRVAR(winreg_SetValueEx__doc__,
{"SetValueEx", (PyCFunction)(void(*)(void))winreg_SetValueEx, METH_FASTCALL, winreg_SetValueEx__doc__}, {"SetValueEx", (PyCFunction)(void(*)(void))winreg_SetValueEx, METH_FASTCALL, winreg_SetValueEx__doc__},
static PyObject * static PyObject *
winreg_SetValueEx_impl(PyObject *module, HKEY key, Py_UNICODE *value_name, winreg_SetValueEx_impl(PyObject *module, HKEY key,
PyObject *reserved, DWORD type, PyObject *value); const Py_UNICODE *value_name, PyObject *reserved,
DWORD type, PyObject *value);
static PyObject * static PyObject *
winreg_SetValueEx(PyObject *module, PyObject *const *args, Py_ssize_t nargs) winreg_SetValueEx(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{ {
PyObject *return_value = NULL; PyObject *return_value = NULL;
HKEY key; HKEY key;
Py_UNICODE *value_name; const Py_UNICODE *value_name;
PyObject *reserved; PyObject *reserved;
DWORD type; DWORD type;
PyObject *value; PyObject *value;
@ -1091,4 +1095,4 @@ winreg_QueryReflectionKey(PyObject *module, PyObject *arg)
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=45a9aec9f9258c0a input=a9049054013a1b77]*/ /*[clinic end generated code: output=ff2cc1951ab1a56c input=a9049054013a1b77]*/

View file

@ -825,9 +825,9 @@ If the function fails, an OSError exception is raised.
[clinic start generated code]*/ [clinic start generated code]*/
static HKEY static HKEY
winreg_ConnectRegistry_impl(PyObject *module, Py_UNICODE *computer_name, winreg_ConnectRegistry_impl(PyObject *module,
HKEY key) const Py_UNICODE *computer_name, HKEY key)
/*[clinic end generated code: output=5ab79d02aa3167b4 input=5f98a891a347e68e]*/ /*[clinic end generated code: output=cd4f70fb9ec901fb input=5f98a891a347e68e]*/
{ {
HKEY retKey; HKEY retKey;
long rc; long rc;
@ -862,8 +862,8 @@ If the function fails, an OSError exception is raised.
[clinic start generated code]*/ [clinic start generated code]*/
static HKEY static HKEY
winreg_CreateKey_impl(PyObject *module, HKEY key, Py_UNICODE *sub_key) winreg_CreateKey_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key)
/*[clinic end generated code: output=9c81d4095527c927 input=3cdd1622488acea2]*/ /*[clinic end generated code: output=2af13910d56eae26 input=3cdd1622488acea2]*/
{ {
HKEY retKey; HKEY retKey;
long rc; long rc;
@ -901,9 +901,10 @@ If the function fails, an OSError exception is raised.
[clinic start generated code]*/ [clinic start generated code]*/
static HKEY static HKEY
winreg_CreateKeyEx_impl(PyObject *module, HKEY key, Py_UNICODE *sub_key, winreg_CreateKeyEx_impl(PyObject *module, HKEY key,
int reserved, REGSAM access) const Py_UNICODE *sub_key, int reserved,
/*[clinic end generated code: output=b9fce6dc5c4e39b1 input=42c2b03f98406b66]*/ REGSAM access)
/*[clinic end generated code: output=643a70ad6a361a97 input=42c2b03f98406b66]*/
{ {
HKEY retKey; HKEY retKey;
long rc; long rc;
@ -936,8 +937,8 @@ is removed. If the function fails, an OSError exception is raised.
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
winreg_DeleteKey_impl(PyObject *module, HKEY key, Py_UNICODE *sub_key) winreg_DeleteKey_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key)
/*[clinic end generated code: output=7734b1e431991ae4 input=b31d225b935e4211]*/ /*[clinic end generated code: output=d2652a84f70e0862 input=b31d225b935e4211]*/
{ {
long rc; long rc;
rc = RegDeleteKeyW(key, sub_key ); rc = RegDeleteKeyW(key, sub_key );
@ -971,9 +972,10 @@ On unsupported Windows versions, NotImplementedError is raised.
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
winreg_DeleteKeyEx_impl(PyObject *module, HKEY key, Py_UNICODE *sub_key, winreg_DeleteKeyEx_impl(PyObject *module, HKEY key,
REGSAM access, int reserved) const Py_UNICODE *sub_key, REGSAM access,
/*[clinic end generated code: output=01378d86ad3eb936 input=711d9d89e7ecbed7]*/ int reserved)
/*[clinic end generated code: output=52a1c8b374ebc003 input=711d9d89e7ecbed7]*/
{ {
HMODULE hMod; HMODULE hMod;
typedef LONG (WINAPI *RDKEFunc)(HKEY, const wchar_t*, REGSAM, int); typedef LONG (WINAPI *RDKEFunc)(HKEY, const wchar_t*, REGSAM, int);
@ -1013,8 +1015,8 @@ Removes a named value from a registry key.
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
winreg_DeleteValue_impl(PyObject *module, HKEY key, Py_UNICODE *value) winreg_DeleteValue_impl(PyObject *module, HKEY key, const Py_UNICODE *value)
/*[clinic end generated code: output=67e7e9a514f84951 input=a78d3407a4197b21]*/ /*[clinic end generated code: output=56fa9d21f3a54371 input=a78d3407a4197b21]*/
{ {
long rc; long rc;
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
@ -1181,8 +1183,9 @@ Expand environment vars.
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
winreg_ExpandEnvironmentStrings_impl(PyObject *module, Py_UNICODE *string) winreg_ExpandEnvironmentStrings_impl(PyObject *module,
/*[clinic end generated code: output=cba46ac293a8af1a input=b2a9714d2b751aa6]*/ const Py_UNICODE *string)
/*[clinic end generated code: output=8fa4e959747a7312 input=b2a9714d2b751aa6]*/
{ {
wchar_t *retValue = NULL; wchar_t *retValue = NULL;
DWORD retValueSize; DWORD retValueSize;
@ -1274,9 +1277,9 @@ tree.
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
winreg_LoadKey_impl(PyObject *module, HKEY key, Py_UNICODE *sub_key, winreg_LoadKey_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key,
Py_UNICODE *file_name) const Py_UNICODE *file_name)
/*[clinic end generated code: output=87344005c5905cde input=e3b5b45ade311582]*/ /*[clinic end generated code: output=65f89f2548cb27c7 input=e3b5b45ade311582]*/
{ {
long rc; long rc;
@ -1308,9 +1311,9 @@ If the function fails, an OSError exception is raised.
[clinic start generated code]*/ [clinic start generated code]*/
static HKEY static HKEY
winreg_OpenKey_impl(PyObject *module, HKEY key, Py_UNICODE *sub_key, winreg_OpenKey_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key,
int reserved, REGSAM access) int reserved, REGSAM access)
/*[clinic end generated code: output=a905f1b947f3ce85 input=098505ac36a9ae28]*/ /*[clinic end generated code: output=8849bff2c30104ad input=098505ac36a9ae28]*/
{ {
HKEY retKey; HKEY retKey;
long rc; long rc;
@ -1335,9 +1338,9 @@ If the function fails, an OSError exception is raised.
[clinic start generated code]*/ [clinic start generated code]*/
static HKEY static HKEY
winreg_OpenKeyEx_impl(PyObject *module, HKEY key, Py_UNICODE *sub_key, winreg_OpenKeyEx_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key,
int reserved, REGSAM access) int reserved, REGSAM access)
/*[clinic end generated code: output=226042593b37e940 input=c6c4972af8622959]*/ /*[clinic end generated code: output=81bc2bd684bc77ae input=c6c4972af8622959]*/
{ {
return winreg_OpenKey_impl(module, key, sub_key, reserved, access); return winreg_OpenKey_impl(module, key, sub_key, reserved, access);
} }
@ -1405,8 +1408,8 @@ completeness.
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
winreg_QueryValue_impl(PyObject *module, HKEY key, Py_UNICODE *sub_key) winreg_QueryValue_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key)
/*[clinic end generated code: output=2bb8d1e02c10d0b6 input=41cafbbf423b21d6]*/ /*[clinic end generated code: output=c655810ae50c63a9 input=41cafbbf423b21d6]*/
{ {
long rc; long rc;
PyObject *retStr; PyObject *retStr;
@ -1472,8 +1475,8 @@ The return value is a tuple of the value and the type_id.
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
winreg_QueryValueEx_impl(PyObject *module, HKEY key, Py_UNICODE *name) winreg_QueryValueEx_impl(PyObject *module, HKEY key, const Py_UNICODE *name)
/*[clinic end generated code: output=5b4fa3e33d6d3e8f input=cf366cada4836891]*/ /*[clinic end generated code: output=f1b85b1c3d887ec7 input=cf366cada4836891]*/
{ {
long rc; long rc;
BYTE *retBuf, *tmp; BYTE *retBuf, *tmp;
@ -1545,8 +1548,8 @@ to the API.
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
winreg_SaveKey_impl(PyObject *module, HKEY key, Py_UNICODE *file_name) winreg_SaveKey_impl(PyObject *module, HKEY key, const Py_UNICODE *file_name)
/*[clinic end generated code: output=1dda1502bd4c30d8 input=da735241f91ac7a2]*/ /*[clinic end generated code: output=ca94b835c88f112b input=da735241f91ac7a2]*/
{ {
LPSECURITY_ATTRIBUTES pSA = NULL; LPSECURITY_ATTRIBUTES pSA = NULL;
@ -1591,10 +1594,10 @@ KEY_SET_VALUE access.
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
winreg_SetValue_impl(PyObject *module, HKEY key, Py_UNICODE *sub_key, winreg_SetValue_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key,
DWORD type, Py_UNICODE *value, DWORD type, const Py_UNICODE *value,
Py_ssize_clean_t value_length) Py_ssize_clean_t value_length)
/*[clinic end generated code: output=1e31931174820631 input=2cd2adab79339c53]*/ /*[clinic end generated code: output=686bedb1cbb4367b input=2cd2adab79339c53]*/
{ {
long rc; long rc;
@ -1657,9 +1660,10 @@ the configuration registry to help the registry perform efficiently.
[clinic start generated code]*/ [clinic start generated code]*/
static PyObject * static PyObject *
winreg_SetValueEx_impl(PyObject *module, HKEY key, Py_UNICODE *value_name, winreg_SetValueEx_impl(PyObject *module, HKEY key,
PyObject *reserved, DWORD type, PyObject *value) const Py_UNICODE *value_name, PyObject *reserved,
/*[clinic end generated code: output=c88c8426b6c00ec7 input=900a9e3990bfb196]*/ DWORD type, PyObject *value)
/*[clinic end generated code: output=811b769a66ae11b7 input=900a9e3990bfb196]*/
{ {
BYTE *data; BYTE *data;
DWORD len; DWORD len;

View file

@ -2858,7 +2858,7 @@ class unicode_converter(CConverter):
@add_legacy_c_converter('Z', accept={str, NoneType}) @add_legacy_c_converter('Z', accept={str, NoneType})
@add_legacy_c_converter('Z#', accept={str, NoneType}, zeroes=True) @add_legacy_c_converter('Z#', accept={str, NoneType}, zeroes=True)
class Py_UNICODE_converter(CConverter): class Py_UNICODE_converter(CConverter):
type = 'Py_UNICODE *' type = 'const Py_UNICODE *'
default_type = (str, Null, NoneType) default_type = (str, Null, NoneType)
format_unit = 'u' format_unit = 'u'