bpo-29464: Rename METH_FASTCALL to METH_FASTCALL|METH_KEYWORDS and make (#1955)

the bare METH_FASTCALL be used for functions with positional-only
parameters.
This commit is contained in:
Serhiy Storchaka 2017-07-03 21:20:15 +03:00 • committed by GitHub
parent aa0aa0492c
commit 6969eaf468
76 changed files with 616 additions and 1916 deletions

View file

@ -11,7 +11,7 @@ PyDoc_STRVAR(_testconsole_write_input__doc__,
"Writes UTF-16-LE encoded bytes to the console as if typed by a user.");
#define _TESTCONSOLE_WRITE_INPUT_METHODDEF \
{"write_input", (PyCFunction)_testconsole_write_input, METH_FASTCALL, _testconsole_write_input__doc__},
{"write_input", (PyCFunction)_testconsole_write_input, METH_FASTCALL|METH_KEYWORDS, _testconsole_write_input__doc__},
static PyObject *
_testconsole_write_input_impl(PyObject *module, PyObject *file,
@ -47,7 +47,7 @@ PyDoc_STRVAR(_testconsole_read_output__doc__,
"Reads a str from the console as written to stdout.");
#define _TESTCONSOLE_READ_OUTPUT_METHODDEF \
{"read_output", (PyCFunction)_testconsole_read_output, METH_FASTCALL, _testconsole_read_output__doc__},
{"read_output", (PyCFunction)_testconsole_read_output, METH_FASTCALL|METH_KEYWORDS, _testconsole_read_output__doc__},
static PyObject *
_testconsole_read_output_impl(PyObject *module, PyObject *file);
@ -79,4 +79,4 @@ exit:
#ifndef _TESTCONSOLE_READ_OUTPUT_METHODDEF
#define _TESTCONSOLE_READ_OUTPUT_METHODDEF
#endif /* !defined(_TESTCONSOLE_READ_OUTPUT_METHODDEF) */
/*[clinic end generated code: output=30d2a80143b65e6f input=a9049054013a1b77]*/
/*[clinic end generated code: output=ac80ed19e6edc0af input=a9049054013a1b77]*/

View file

@ -43,17 +43,13 @@ static PyObject *
msvcrt_locking_impl(PyObject *module, int fd, int mode, long nbytes);
static PyObject *
msvcrt_locking(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
msvcrt_locking(PyObject *module, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
int fd;
int mode;
long nbytes;
if (!_PyArg_NoStackKeywords("locking", kwnames)) {
goto exit;
}
if (!_PyArg_ParseStack(args, nargs, "iil:locking",
&fd, &mode, &nbytes)) {
goto exit;
@ -82,17 +78,13 @@ static long
msvcrt_setmode_impl(PyObject *module, int fd, int flags);
static PyObject *
msvcrt_setmode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
msvcrt_setmode(PyObject *module, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
int fd;
int flags;
long _return_value;
if (!_PyArg_NoStackKeywords("setmode", kwnames)) {
goto exit;
}
if (!_PyArg_ParseStack(args, nargs, "ii:setmode",
&fd, &flags)) {
goto exit;
@ -124,17 +116,13 @@ static long
msvcrt_open_osfhandle_impl(PyObject *module, intptr_t handle, int flags);
static PyObject *
msvcrt_open_osfhandle(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
msvcrt_open_osfhandle(PyObject *module, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
intptr_t handle;
int flags;
long _return_value;
if (!_PyArg_NoStackKeywords("open_osfhandle", kwnames)) {
goto exit;
}
if (!_PyArg_ParseStack(args, nargs, ""_Py_PARSE_INTPTR"i:open_osfhandle",
&handle, &flags)) {
goto exit;
@ -442,17 +430,13 @@ static long
msvcrt_CrtSetReportFile_impl(PyObject *module, int type, int file);
static PyObject *
msvcrt_CrtSetReportFile(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
msvcrt_CrtSetReportFile(PyObject *module, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
int type;
int file;
long _return_value;
if (!_PyArg_NoStackKeywords("CrtSetReportFile", kwnames)) {
goto exit;
}
if (!_PyArg_ParseStack(args, nargs, "ii:CrtSetReportFile",
&type, &file)) {
goto exit;
@ -486,17 +470,13 @@ static long
msvcrt_CrtSetReportMode_impl(PyObject *module, int type, int mode);
static PyObject *
msvcrt_CrtSetReportMode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
msvcrt_CrtSetReportMode(PyObject *module, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
int type;
int mode;
long _return_value;
if (!_PyArg_NoStackKeywords("CrtSetReportMode", kwnames)) {
goto exit;
}
if (!_PyArg_ParseStack(args, nargs, "ii:CrtSetReportMode",
&type, &mode)) {
goto exit;
@ -589,4 +569,4 @@ exit:
#ifndef MSVCRT_SET_ERROR_MODE_METHODDEF
#define MSVCRT_SET_ERROR_MODE_METHODDEF
#endif /* !defined(MSVCRT_SET_ERROR_MODE_METHODDEF) */
/*[clinic end generated code: output=9e82abfdd357b0da input=a9049054013a1b77]*/
/*[clinic end generated code: output=8e9e57c48c4defcc input=a9049054013a1b77]*/

View file

@ -77,7 +77,7 @@ PyDoc_STRVAR(winreg_HKEYType___exit____doc__,
"\n");
#define WINREG_HKEYTYPE___EXIT___METHODDEF \
{"__exit__", (PyCFunction)winreg_HKEYType___exit__, METH_FASTCALL, winreg_HKEYType___exit____doc__},
{"__exit__", (PyCFunction)winreg_HKEYType___exit__, METH_FASTCALL|METH_KEYWORDS, winreg_HKEYType___exit____doc__},
static PyObject *
winreg_HKEYType___exit___impl(PyHKEYObject *self, PyObject *exc_type,
@ -141,17 +141,13 @@ winreg_ConnectRegistry_impl(PyObject *module, Py_UNICODE *computer_name,
HKEY key);
static PyObject *
winreg_ConnectRegistry(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
winreg_ConnectRegistry(PyObject *module, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_UNICODE *computer_name;
HKEY key;
HKEY _return_value;
if (!_PyArg_NoStackKeywords("ConnectRegistry", kwnames)) {
goto exit;
}
if (!_PyArg_ParseStack(args, nargs, "ZO&:ConnectRegistry",
&computer_name, clinic_HKEY_converter, &key)) {
goto exit;
@ -192,17 +188,13 @@ static HKEY
winreg_CreateKey_impl(PyObject *module, HKEY key, Py_UNICODE *sub_key);
static PyObject *
winreg_CreateKey(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
winreg_CreateKey(PyObject *module, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
HKEY key;
Py_UNICODE *sub_key;
HKEY _return_value;
if (!_PyArg_NoStackKeywords("CreateKey", kwnames)) {
goto exit;
}
if (!_PyArg_ParseStack(args, nargs, "O&Z:CreateKey",
clinic_HKEY_converter, &key, &sub_key)) {
goto exit;
@ -243,7 +235,7 @@ PyDoc_STRVAR(winreg_CreateKeyEx__doc__,
"If the function fails, an OSError exception is raised.");
#define WINREG_CREATEKEYEX_METHODDEF \
{"CreateKeyEx", (PyCFunction)winreg_CreateKeyEx, METH_FASTCALL, winreg_CreateKeyEx__doc__},
{"CreateKeyEx", (PyCFunction)winreg_CreateKeyEx, METH_FASTCALL|METH_KEYWORDS, winreg_CreateKeyEx__doc__},
static HKEY
winreg_CreateKeyEx_impl(PyObject *module, HKEY key, Py_UNICODE *sub_key,
@ -300,16 +292,12 @@ static PyObject *
winreg_DeleteKey_impl(PyObject *module, HKEY key, Py_UNICODE *sub_key);
static PyObject *
winreg_DeleteKey(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
winreg_DeleteKey(PyObject *module, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
HKEY key;
Py_UNICODE *sub_key;
if (!_PyArg_NoStackKeywords("DeleteKey", kwnames)) {
goto exit;
}
if (!_PyArg_ParseStack(args, nargs, "O&u:DeleteKey",
clinic_HKEY_converter, &key, &sub_key)) {
goto exit;
@ -346,7 +334,7 @@ PyDoc_STRVAR(winreg_DeleteKeyEx__doc__,
"On unsupported Windows versions, NotImplementedError is raised.");
#define WINREG_DELETEKEYEX_METHODDEF \
{"DeleteKeyEx", (PyCFunction)winreg_DeleteKeyEx, METH_FASTCALL, winreg_DeleteKeyEx__doc__},
{"DeleteKeyEx", (PyCFunction)winreg_DeleteKeyEx, METH_FASTCALL|METH_KEYWORDS, winreg_DeleteKeyEx__doc__},
static PyObject *
winreg_DeleteKeyEx_impl(PyObject *module, HKEY key, Py_UNICODE *sub_key,
@ -391,16 +379,12 @@ static PyObject *
winreg_DeleteValue_impl(PyObject *module, HKEY key, Py_UNICODE *value);
static PyObject *
winreg_DeleteValue(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
winreg_DeleteValue(PyObject *module, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
HKEY key;
Py_UNICODE *value;
if (!_PyArg_NoStackKeywords("DeleteValue", kwnames)) {
goto exit;
}
if (!_PyArg_ParseStack(args, nargs, "O&Z:DeleteValue",
clinic_HKEY_converter, &key, &value)) {
goto exit;
@ -433,16 +417,12 @@ static PyObject *
winreg_EnumKey_impl(PyObject *module, HKEY key, int index);
static PyObject *
winreg_EnumKey(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
winreg_EnumKey(PyObject *module, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
HKEY key;
int index;
if (!_PyArg_NoStackKeywords("EnumKey", kwnames)) {
goto exit;
}
if (!_PyArg_ParseStack(args, nargs, "O&i:EnumKey",
clinic_HKEY_converter, &key, &index)) {
goto exit;
@ -484,16 +464,12 @@ static PyObject *
winreg_EnumValue_impl(PyObject *module, HKEY key, int index);
static PyObject *
winreg_EnumValue(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
winreg_EnumValue(PyObject *module, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
HKEY key;
int index;
if (!_PyArg_NoStackKeywords("EnumValue", kwnames)) {
goto exit;
}
if (!_PyArg_ParseStack(args, nargs, "O&i:EnumValue",
clinic_HKEY_converter, &key, &index)) {
goto exit;
@ -607,17 +583,13 @@ winreg_LoadKey_impl(PyObject *module, HKEY key, Py_UNICODE *sub_key,
Py_UNICODE *file_name);
static PyObject *
winreg_LoadKey(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
winreg_LoadKey(PyObject *module, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
HKEY key;
Py_UNICODE *sub_key;
Py_UNICODE *file_name;
if (!_PyArg_NoStackKeywords("LoadKey", kwnames)) {
goto exit;
}
if (!_PyArg_ParseStack(args, nargs, "O&uu:LoadKey",
clinic_HKEY_converter, &key, &sub_key, &file_name)) {
goto exit;
@ -648,7 +620,7 @@ PyDoc_STRVAR(winreg_OpenKey__doc__,
"If the function fails, an OSError exception is raised.");
#define WINREG_OPENKEY_METHODDEF \
{"OpenKey", (PyCFunction)winreg_OpenKey, METH_FASTCALL, winreg_OpenKey__doc__},
{"OpenKey", (PyCFunction)winreg_OpenKey, METH_FASTCALL|METH_KEYWORDS, winreg_OpenKey__doc__},
static HKEY
winreg_OpenKey_impl(PyObject *module, HKEY key, Py_UNICODE *sub_key,
@ -700,7 +672,7 @@ PyDoc_STRVAR(winreg_OpenKeyEx__doc__,
"If the function fails, an OSError exception is raised.");
#define WINREG_OPENKEYEX_METHODDEF \
{"OpenKeyEx", (PyCFunction)winreg_OpenKeyEx, METH_FASTCALL, winreg_OpenKeyEx__doc__},
{"OpenKeyEx", (PyCFunction)winreg_OpenKeyEx, METH_FASTCALL|METH_KEYWORDS, winreg_OpenKeyEx__doc__},
static HKEY
winreg_OpenKeyEx_impl(PyObject *module, HKEY key, Py_UNICODE *sub_key,
@ -795,16 +767,12 @@ static PyObject *
winreg_QueryValue_impl(PyObject *module, HKEY key, Py_UNICODE *sub_key);
static PyObject *
winreg_QueryValue(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
winreg_QueryValue(PyObject *module, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
HKEY key;
Py_UNICODE *sub_key;
if (!_PyArg_NoStackKeywords("QueryValue", kwnames)) {
goto exit;
}
if (!_PyArg_ParseStack(args, nargs, "O&Z:QueryValue",
clinic_HKEY_converter, &key, &sub_key)) {
goto exit;
@ -838,16 +806,12 @@ static PyObject *
winreg_QueryValueEx_impl(PyObject *module, HKEY key, Py_UNICODE *name);
static PyObject *
winreg_QueryValueEx(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
winreg_QueryValueEx(PyObject *module, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
HKEY key;
Py_UNICODE *name;
if (!_PyArg_NoStackKeywords("QueryValueEx", kwnames)) {
goto exit;
}
if (!_PyArg_ParseStack(args, nargs, "O&Z:QueryValueEx",
clinic_HKEY_converter, &key, &name)) {
goto exit;
@ -886,16 +850,12 @@ static PyObject *
winreg_SaveKey_impl(PyObject *module, HKEY key, Py_UNICODE *file_name);
static PyObject *
winreg_SaveKey(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
winreg_SaveKey(PyObject *module, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
HKEY key;
Py_UNICODE *file_name;
if (!_PyArg_NoStackKeywords("SaveKey", kwnames)) {
goto exit;
}
if (!_PyArg_ParseStack(args, nargs, "O&u:SaveKey",
clinic_HKEY_converter, &key, &file_name)) {
goto exit;
@ -941,7 +901,7 @@ winreg_SetValue_impl(PyObject *module, HKEY key, Py_UNICODE *sub_key,
Py_ssize_clean_t value_length);
static PyObject *
winreg_SetValue(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
winreg_SetValue(PyObject *module, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
HKEY key;
@ -950,10 +910,6 @@ winreg_SetValue(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *k
Py_UNICODE *value;
Py_ssize_clean_t value_length;
if (!_PyArg_NoStackKeywords("SetValue", kwnames)) {
goto exit;
}
if (!_PyArg_ParseStack(args, nargs, "O&Zku#:SetValue",
clinic_HKEY_converter, &key, &sub_key, &type, &value, &value_length)) {
goto exit;
@ -1015,7 +971,7 @@ winreg_SetValueEx_impl(PyObject *module, HKEY key, Py_UNICODE *value_name,
PyObject *reserved, DWORD type, PyObject *value);
static PyObject *
winreg_SetValueEx(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
winreg_SetValueEx(PyObject *module, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
HKEY key;
@ -1024,10 +980,6 @@ winreg_SetValueEx(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject
DWORD type;
PyObject *value;
if (!_PyArg_NoStackKeywords("SetValueEx", kwnames)) {
goto exit;
}
if (!_PyArg_ParseStack(args, nargs, "O&ZOkO:SetValueEx",
clinic_HKEY_converter, &key, &value_name, &reserved, &type, &value)) {
goto exit;
@ -1139,4 +1091,4 @@ winreg_QueryReflectionKey(PyObject *module, PyObject *arg)
exit:
return return_value;
}
/*[clinic end generated code: output=57f166c252c5ba7a input=a9049054013a1b77]*/
/*[clinic end generated code: output=9f7991a8580bbd93 input=a9049054013a1b77]*/

View file

@ -14,7 +14,7 @@ PyDoc_STRVAR(winsound_PlaySound__doc__,
" Flag values, ored together. See module documentation.");
#define WINSOUND_PLAYSOUND_METHODDEF \
{"PlaySound", (PyCFunction)winsound_PlaySound, METH_FASTCALL, winsound_PlaySound__doc__},
{"PlaySound", (PyCFunction)winsound_PlaySound, METH_FASTCALL|METH_KEYWORDS, winsound_PlaySound__doc__},
static PyObject *
winsound_PlaySound_impl(PyObject *module, PyObject *sound, int flags);
@ -51,7 +51,7 @@ PyDoc_STRVAR(winsound_Beep__doc__,
" How long the sound should play, in milliseconds.");
#define WINSOUND_BEEP_METHODDEF \
{"Beep", (PyCFunction)winsound_Beep, METH_FASTCALL, winsound_Beep__doc__},
{"Beep", (PyCFunction)winsound_Beep, METH_FASTCALL|METH_KEYWORDS, winsound_Beep__doc__},
static PyObject *
winsound_Beep_impl(PyObject *module, int frequency, int duration);
@ -84,7 +84,7 @@ PyDoc_STRVAR(winsound_MessageBeep__doc__,
"x defaults to MB_OK.");
#define WINSOUND_MESSAGEBEEP_METHODDEF \
{"MessageBeep", (PyCFunction)winsound_MessageBeep, METH_FASTCALL, winsound_MessageBeep__doc__},
{"MessageBeep", (PyCFunction)winsound_MessageBeep, METH_FASTCALL|METH_KEYWORDS, winsound_MessageBeep__doc__},
static PyObject *
winsound_MessageBeep_impl(PyObject *module, int type);
@ -106,4 +106,4 @@ winsound_MessageBeep(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObje
exit:
return return_value;
}
/*[clinic end generated code: output=102a556c665a277d input=a9049054013a1b77]*/
/*[clinic end generated code: output=d22e41446929d3ef input=a9049054013a1b77]*/