diff options
Diffstat (limited to 'Modules/clinic')
35 files changed, 4087 insertions, 733 deletions
diff --git a/Modules/clinic/_asynciomodule.c.h b/Modules/clinic/_asynciomodule.c.h index 052d252331..f3204fb9a9 100644 --- a/Modules/clinic/_asynciomodule.c.h +++ b/Modules/clinic/_asynciomodule.c.h @@ -280,7 +280,7 @@ _asyncio_Task_current_task(PyTypeObject *type, PyObject **args, Py_ssize_t nargs static _PyArg_Parser _parser = {"|O:current_task", _keywords, 0}; PyObject *loop = NULL; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &loop)) { goto exit; } @@ -312,7 +312,7 @@ _asyncio_Task_all_tasks(PyTypeObject *type, PyObject **args, Py_ssize_t nargs, P static _PyArg_Parser _parser = {"|O:all_tasks", _keywords, 0}; PyObject *loop = NULL; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &loop)) { goto exit; } @@ -412,7 +412,7 @@ _asyncio_Task_get_stack(TaskObj *self, PyObject **args, Py_ssize_t nargs, PyObje static _PyArg_Parser _parser = {"|$O:get_stack", _keywords, 0}; PyObject *limit = Py_None; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &limit)) { goto exit; } @@ -450,7 +450,7 @@ _asyncio_Task_print_stack(TaskObj *self, PyObject **args, Py_ssize_t nargs, PyOb PyObject *limit = Py_None; PyObject *file = Py_None; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &limit, &file)) { goto exit; } @@ -479,7 +479,7 @@ _asyncio_Task__step(TaskObj *self, PyObject **args, Py_ssize_t nargs, PyObject * static _PyArg_Parser _parser = {"|O:_step", _keywords, 0}; PyObject *exc = NULL; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &exc)) { goto exit; } @@ -508,7 +508,7 @@ _asyncio_Task__wakeup(TaskObj *self, PyObject **args, Py_ssize_t nargs, PyObject static _PyArg_Parser _parser = {"O:_wakeup", _keywords, 0}; PyObject *fut; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &fut)) { goto exit; } @@ -517,4 +517,4 @@ _asyncio_Task__wakeup(TaskObj *self, PyObject **args, Py_ssize_t nargs, PyObject exit: return return_value; } -/*[clinic end generated code: output=8f036321bb083066 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=07a15bbb28d03edc input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_bz2module.c.h b/Modules/clinic/_bz2module.c.h index 1ca810c9e7..b791f28b67 100644 --- a/Modules/clinic/_bz2module.c.h +++ b/Modules/clinic/_bz2module.c.h @@ -130,7 +130,7 @@ _bz2_BZ2Decompressor_decompress(BZ2Decompressor *self, PyObject **args, Py_ssize Py_buffer data = {NULL, NULL}; Py_ssize_t max_length = -1; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &data, &max_length)) { goto exit; } @@ -174,4 +174,4 @@ _bz2_BZ2Decompressor___init__(PyObject *self, PyObject *args, PyObject *kwargs) exit: return return_value; } -/*[clinic end generated code: output=7e57af0b368d3e55 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=0e97a1d716b35a14 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_codecsmodule.c.h b/Modules/clinic/_codecsmodule.c.h index 056287d06a..982fc766c7 100644 --- a/Modules/clinic/_codecsmodule.c.h +++ b/Modules/clinic/_codecsmodule.c.h @@ -71,7 +71,7 @@ _codecs_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kw const char *encoding = NULL; const char *errors = NULL; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &obj, &encoding, &errors)) { goto exit; } @@ -110,7 +110,7 @@ _codecs_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kw const char *encoding = NULL; const char *errors = NULL; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &obj, &encoding, &errors)) { goto exit; } @@ -153,23 +153,27 @@ PyDoc_STRVAR(_codecs_escape_decode__doc__, "\n"); #define _CODECS_ESCAPE_DECODE_METHODDEF \ - {"escape_decode", (PyCFunction)_codecs_escape_decode, METH_VARARGS, _codecs_escape_decode__doc__}, + {"escape_decode", (PyCFunction)_codecs_escape_decode, METH_FASTCALL, _codecs_escape_decode__doc__}, static PyObject * _codecs_escape_decode_impl(PyObject *module, Py_buffer *data, const char *errors); static PyObject * -_codecs_escape_decode(PyObject *module, PyObject *args) +_codecs_escape_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "s*|z:escape_decode", + if (!_PyArg_ParseStack(args, nargs, "s*|z:escape_decode", &data, &errors)) { goto exit; } + + if (!_PyArg_NoStackKeywords("escape_decode", kwnames)) { + goto exit; + } return_value = _codecs_escape_decode_impl(module, &data, errors); exit: @@ -187,23 +191,27 @@ PyDoc_STRVAR(_codecs_escape_encode__doc__, "\n"); #define _CODECS_ESCAPE_ENCODE_METHODDEF \ - {"escape_encode", (PyCFunction)_codecs_escape_encode, METH_VARARGS, _codecs_escape_encode__doc__}, + {"escape_encode", (PyCFunction)_codecs_escape_encode, METH_FASTCALL, _codecs_escape_encode__doc__}, static PyObject * _codecs_escape_encode_impl(PyObject *module, PyObject *data, const char *errors); static PyObject * -_codecs_escape_encode(PyObject *module, PyObject *args) +_codecs_escape_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *data; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "O!|z:escape_encode", + if (!_PyArg_ParseStack(args, nargs, "O!|z:escape_encode", &PyBytes_Type, &data, &errors)) { goto exit; } + + if (!_PyArg_NoStackKeywords("escape_encode", kwnames)) { + goto exit; + } return_value = _codecs_escape_encode_impl(module, data, errors); exit: @@ -216,23 +224,27 @@ PyDoc_STRVAR(_codecs_unicode_internal_decode__doc__, "\n"); #define _CODECS_UNICODE_INTERNAL_DECODE_METHODDEF \ - {"unicode_internal_decode", (PyCFunction)_codecs_unicode_internal_decode, METH_VARARGS, _codecs_unicode_internal_decode__doc__}, + {"unicode_internal_decode", (PyCFunction)_codecs_unicode_internal_decode, METH_FASTCALL, _codecs_unicode_internal_decode__doc__}, static PyObject * _codecs_unicode_internal_decode_impl(PyObject *module, PyObject *obj, const char *errors); static PyObject * -_codecs_unicode_internal_decode(PyObject *module, PyObject *args) +_codecs_unicode_internal_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *obj; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "O|z:unicode_internal_decode", + if (!_PyArg_ParseStack(args, nargs, "O|z:unicode_internal_decode", &obj, &errors)) { goto exit; } + + if (!_PyArg_NoStackKeywords("unicode_internal_decode", kwnames)) { + goto exit; + } return_value = _codecs_unicode_internal_decode_impl(module, obj, errors); exit: @@ -245,24 +257,28 @@ PyDoc_STRVAR(_codecs_utf_7_decode__doc__, "\n"); #define _CODECS_UTF_7_DECODE_METHODDEF \ - {"utf_7_decode", (PyCFunction)_codecs_utf_7_decode, METH_VARARGS, _codecs_utf_7_decode__doc__}, + {"utf_7_decode", (PyCFunction)_codecs_utf_7_decode, METH_FASTCALL, _codecs_utf_7_decode__doc__}, static PyObject * _codecs_utf_7_decode_impl(PyObject *module, Py_buffer *data, const char *errors, int final); static PyObject * -_codecs_utf_7_decode(PyObject *module, PyObject *args) +_codecs_utf_7_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; const char *errors = NULL; int final = 0; - if (!PyArg_ParseTuple(args, "y*|zi:utf_7_decode", + if (!_PyArg_ParseStack(args, nargs, "y*|zi:utf_7_decode", &data, &errors, &final)) { goto exit; } + + if (!_PyArg_NoStackKeywords("utf_7_decode", kwnames)) { + goto exit; + } return_value = _codecs_utf_7_decode_impl(module, &data, errors, final); exit: @@ -280,24 +296,28 @@ PyDoc_STRVAR(_codecs_utf_8_decode__doc__, "\n"); #define _CODECS_UTF_8_DECODE_METHODDEF \ - {"utf_8_decode", (PyCFunction)_codecs_utf_8_decode, METH_VARARGS, _codecs_utf_8_decode__doc__}, + {"utf_8_decode", (PyCFunction)_codecs_utf_8_decode, METH_FASTCALL, _codecs_utf_8_decode__doc__}, static PyObject * _codecs_utf_8_decode_impl(PyObject *module, Py_buffer *data, const char *errors, int final); static PyObject * -_codecs_utf_8_decode(PyObject *module, PyObject *args) +_codecs_utf_8_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; const char *errors = NULL; int final = 0; - if (!PyArg_ParseTuple(args, "y*|zi:utf_8_decode", + if (!_PyArg_ParseStack(args, nargs, "y*|zi:utf_8_decode", &data, &errors, &final)) { goto exit; } + + if (!_PyArg_NoStackKeywords("utf_8_decode", kwnames)) { + goto exit; + } return_value = _codecs_utf_8_decode_impl(module, &data, errors, final); exit: @@ -315,24 +335,28 @@ PyDoc_STRVAR(_codecs_utf_16_decode__doc__, "\n"); #define _CODECS_UTF_16_DECODE_METHODDEF \ - {"utf_16_decode", (PyCFunction)_codecs_utf_16_decode, METH_VARARGS, _codecs_utf_16_decode__doc__}, + {"utf_16_decode", (PyCFunction)_codecs_utf_16_decode, METH_FASTCALL, _codecs_utf_16_decode__doc__}, static PyObject * _codecs_utf_16_decode_impl(PyObject *module, Py_buffer *data, const char *errors, int final); static PyObject * -_codecs_utf_16_decode(PyObject *module, PyObject *args) +_codecs_utf_16_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; const char *errors = NULL; int final = 0; - if (!PyArg_ParseTuple(args, "y*|zi:utf_16_decode", + if (!_PyArg_ParseStack(args, nargs, "y*|zi:utf_16_decode", &data, &errors, &final)) { goto exit; } + + if (!_PyArg_NoStackKeywords("utf_16_decode", kwnames)) { + goto exit; + } return_value = _codecs_utf_16_decode_impl(module, &data, errors, final); exit: @@ -350,24 +374,28 @@ PyDoc_STRVAR(_codecs_utf_16_le_decode__doc__, "\n"); #define _CODECS_UTF_16_LE_DECODE_METHODDEF \ - {"utf_16_le_decode", (PyCFunction)_codecs_utf_16_le_decode, METH_VARARGS, _codecs_utf_16_le_decode__doc__}, + {"utf_16_le_decode", (PyCFunction)_codecs_utf_16_le_decode, METH_FASTCALL, _codecs_utf_16_le_decode__doc__}, static PyObject * _codecs_utf_16_le_decode_impl(PyObject *module, Py_buffer *data, const char *errors, int final); static PyObject * -_codecs_utf_16_le_decode(PyObject *module, PyObject *args) +_codecs_utf_16_le_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; const char *errors = NULL; int final = 0; - if (!PyArg_ParseTuple(args, "y*|zi:utf_16_le_decode", + if (!_PyArg_ParseStack(args, nargs, "y*|zi:utf_16_le_decode", &data, &errors, &final)) { goto exit; } + + if (!_PyArg_NoStackKeywords("utf_16_le_decode", kwnames)) { + goto exit; + } return_value = _codecs_utf_16_le_decode_impl(module, &data, errors, final); exit: @@ -385,24 +413,28 @@ PyDoc_STRVAR(_codecs_utf_16_be_decode__doc__, "\n"); #define _CODECS_UTF_16_BE_DECODE_METHODDEF \ - {"utf_16_be_decode", (PyCFunction)_codecs_utf_16_be_decode, METH_VARARGS, _codecs_utf_16_be_decode__doc__}, + {"utf_16_be_decode", (PyCFunction)_codecs_utf_16_be_decode, METH_FASTCALL, _codecs_utf_16_be_decode__doc__}, static PyObject * _codecs_utf_16_be_decode_impl(PyObject *module, Py_buffer *data, const char *errors, int final); static PyObject * -_codecs_utf_16_be_decode(PyObject *module, PyObject *args) +_codecs_utf_16_be_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; const char *errors = NULL; int final = 0; - if (!PyArg_ParseTuple(args, "y*|zi:utf_16_be_decode", + if (!_PyArg_ParseStack(args, nargs, "y*|zi:utf_16_be_decode", &data, &errors, &final)) { goto exit; } + + if (!_PyArg_NoStackKeywords("utf_16_be_decode", kwnames)) { + goto exit; + } return_value = _codecs_utf_16_be_decode_impl(module, &data, errors, final); exit: @@ -421,14 +453,14 @@ PyDoc_STRVAR(_codecs_utf_16_ex_decode__doc__, "\n"); #define _CODECS_UTF_16_EX_DECODE_METHODDEF \ - {"utf_16_ex_decode", (PyCFunction)_codecs_utf_16_ex_decode, METH_VARARGS, _codecs_utf_16_ex_decode__doc__}, + {"utf_16_ex_decode", (PyCFunction)_codecs_utf_16_ex_decode, METH_FASTCALL, _codecs_utf_16_ex_decode__doc__}, static PyObject * _codecs_utf_16_ex_decode_impl(PyObject *module, Py_buffer *data, const char *errors, int byteorder, int final); static PyObject * -_codecs_utf_16_ex_decode(PyObject *module, PyObject *args) +_codecs_utf_16_ex_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; @@ -436,10 +468,14 @@ _codecs_utf_16_ex_decode(PyObject *module, PyObject *args) int byteorder = 0; int final = 0; - if (!PyArg_ParseTuple(args, "y*|zii:utf_16_ex_decode", + if (!_PyArg_ParseStack(args, nargs, "y*|zii:utf_16_ex_decode", &data, &errors, &byteorder, &final)) { goto exit; } + + if (!_PyArg_NoStackKeywords("utf_16_ex_decode", kwnames)) { + goto exit; + } return_value = _codecs_utf_16_ex_decode_impl(module, &data, errors, byteorder, final); exit: @@ -457,24 +493,28 @@ PyDoc_STRVAR(_codecs_utf_32_decode__doc__, "\n"); #define _CODECS_UTF_32_DECODE_METHODDEF \ - {"utf_32_decode", (PyCFunction)_codecs_utf_32_decode, METH_VARARGS, _codecs_utf_32_decode__doc__}, + {"utf_32_decode", (PyCFunction)_codecs_utf_32_decode, METH_FASTCALL, _codecs_utf_32_decode__doc__}, static PyObject * _codecs_utf_32_decode_impl(PyObject *module, Py_buffer *data, const char *errors, int final); static PyObject * -_codecs_utf_32_decode(PyObject *module, PyObject *args) +_codecs_utf_32_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; const char *errors = NULL; int final = 0; - if (!PyArg_ParseTuple(args, "y*|zi:utf_32_decode", + if (!_PyArg_ParseStack(args, nargs, "y*|zi:utf_32_decode", &data, &errors, &final)) { goto exit; } + + if (!_PyArg_NoStackKeywords("utf_32_decode", kwnames)) { + goto exit; + } return_value = _codecs_utf_32_decode_impl(module, &data, errors, final); exit: @@ -492,24 +532,28 @@ PyDoc_STRVAR(_codecs_utf_32_le_decode__doc__, "\n"); #define _CODECS_UTF_32_LE_DECODE_METHODDEF \ - {"utf_32_le_decode", (PyCFunction)_codecs_utf_32_le_decode, METH_VARARGS, _codecs_utf_32_le_decode__doc__}, + {"utf_32_le_decode", (PyCFunction)_codecs_utf_32_le_decode, METH_FASTCALL, _codecs_utf_32_le_decode__doc__}, static PyObject * _codecs_utf_32_le_decode_impl(PyObject *module, Py_buffer *data, const char *errors, int final); static PyObject * -_codecs_utf_32_le_decode(PyObject *module, PyObject *args) +_codecs_utf_32_le_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; const char *errors = NULL; int final = 0; - if (!PyArg_ParseTuple(args, "y*|zi:utf_32_le_decode", + if (!_PyArg_ParseStack(args, nargs, "y*|zi:utf_32_le_decode", &data, &errors, &final)) { goto exit; } + + if (!_PyArg_NoStackKeywords("utf_32_le_decode", kwnames)) { + goto exit; + } return_value = _codecs_utf_32_le_decode_impl(module, &data, errors, final); exit: @@ -527,24 +571,28 @@ PyDoc_STRVAR(_codecs_utf_32_be_decode__doc__, "\n"); #define _CODECS_UTF_32_BE_DECODE_METHODDEF \ - {"utf_32_be_decode", (PyCFunction)_codecs_utf_32_be_decode, METH_VARARGS, _codecs_utf_32_be_decode__doc__}, + {"utf_32_be_decode", (PyCFunction)_codecs_utf_32_be_decode, METH_FASTCALL, _codecs_utf_32_be_decode__doc__}, static PyObject * _codecs_utf_32_be_decode_impl(PyObject *module, Py_buffer *data, const char *errors, int final); static PyObject * -_codecs_utf_32_be_decode(PyObject *module, PyObject *args) +_codecs_utf_32_be_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; const char *errors = NULL; int final = 0; - if (!PyArg_ParseTuple(args, "y*|zi:utf_32_be_decode", + if (!_PyArg_ParseStack(args, nargs, "y*|zi:utf_32_be_decode", &data, &errors, &final)) { goto exit; } + + if (!_PyArg_NoStackKeywords("utf_32_be_decode", kwnames)) { + goto exit; + } return_value = _codecs_utf_32_be_decode_impl(module, &data, errors, final); exit: @@ -563,14 +611,14 @@ PyDoc_STRVAR(_codecs_utf_32_ex_decode__doc__, "\n"); #define _CODECS_UTF_32_EX_DECODE_METHODDEF \ - {"utf_32_ex_decode", (PyCFunction)_codecs_utf_32_ex_decode, METH_VARARGS, _codecs_utf_32_ex_decode__doc__}, + {"utf_32_ex_decode", (PyCFunction)_codecs_utf_32_ex_decode, METH_FASTCALL, _codecs_utf_32_ex_decode__doc__}, static PyObject * _codecs_utf_32_ex_decode_impl(PyObject *module, Py_buffer *data, const char *errors, int byteorder, int final); static PyObject * -_codecs_utf_32_ex_decode(PyObject *module, PyObject *args) +_codecs_utf_32_ex_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; @@ -578,10 +626,14 @@ _codecs_utf_32_ex_decode(PyObject *module, PyObject *args) int byteorder = 0; int final = 0; - if (!PyArg_ParseTuple(args, "y*|zii:utf_32_ex_decode", + if (!_PyArg_ParseStack(args, nargs, "y*|zii:utf_32_ex_decode", &data, &errors, &byteorder, &final)) { goto exit; } + + if (!_PyArg_NoStackKeywords("utf_32_ex_decode", kwnames)) { + goto exit; + } return_value = _codecs_utf_32_ex_decode_impl(module, &data, errors, byteorder, final); exit: @@ -599,23 +651,27 @@ PyDoc_STRVAR(_codecs_unicode_escape_decode__doc__, "\n"); #define _CODECS_UNICODE_ESCAPE_DECODE_METHODDEF \ - {"unicode_escape_decode", (PyCFunction)_codecs_unicode_escape_decode, METH_VARARGS, _codecs_unicode_escape_decode__doc__}, + {"unicode_escape_decode", (PyCFunction)_codecs_unicode_escape_decode, METH_FASTCALL, _codecs_unicode_escape_decode__doc__}, static PyObject * _codecs_unicode_escape_decode_impl(PyObject *module, Py_buffer *data, const char *errors); static PyObject * -_codecs_unicode_escape_decode(PyObject *module, PyObject *args) +_codecs_unicode_escape_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "s*|z:unicode_escape_decode", + if (!_PyArg_ParseStack(args, nargs, "s*|z:unicode_escape_decode", &data, &errors)) { goto exit; } + + if (!_PyArg_NoStackKeywords("unicode_escape_decode", kwnames)) { + goto exit; + } return_value = _codecs_unicode_escape_decode_impl(module, &data, errors); exit: @@ -633,23 +689,27 @@ PyDoc_STRVAR(_codecs_raw_unicode_escape_decode__doc__, "\n"); #define _CODECS_RAW_UNICODE_ESCAPE_DECODE_METHODDEF \ - {"raw_unicode_escape_decode", (PyCFunction)_codecs_raw_unicode_escape_decode, METH_VARARGS, _codecs_raw_unicode_escape_decode__doc__}, + {"raw_unicode_escape_decode", (PyCFunction)_codecs_raw_unicode_escape_decode, METH_FASTCALL, _codecs_raw_unicode_escape_decode__doc__}, static PyObject * _codecs_raw_unicode_escape_decode_impl(PyObject *module, Py_buffer *data, const char *errors); static PyObject * -_codecs_raw_unicode_escape_decode(PyObject *module, PyObject *args) +_codecs_raw_unicode_escape_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "s*|z:raw_unicode_escape_decode", + if (!_PyArg_ParseStack(args, nargs, "s*|z:raw_unicode_escape_decode", &data, &errors)) { goto exit; } + + if (!_PyArg_NoStackKeywords("raw_unicode_escape_decode", kwnames)) { + goto exit; + } return_value = _codecs_raw_unicode_escape_decode_impl(module, &data, errors); exit: @@ -667,23 +727,27 @@ PyDoc_STRVAR(_codecs_latin_1_decode__doc__, "\n"); #define _CODECS_LATIN_1_DECODE_METHODDEF \ - {"latin_1_decode", (PyCFunction)_codecs_latin_1_decode, METH_VARARGS, _codecs_latin_1_decode__doc__}, + {"latin_1_decode", (PyCFunction)_codecs_latin_1_decode, METH_FASTCALL, _codecs_latin_1_decode__doc__}, static PyObject * _codecs_latin_1_decode_impl(PyObject *module, Py_buffer *data, const char *errors); static PyObject * -_codecs_latin_1_decode(PyObject *module, PyObject *args) +_codecs_latin_1_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "y*|z:latin_1_decode", + if (!_PyArg_ParseStack(args, nargs, "y*|z:latin_1_decode", &data, &errors)) { goto exit; } + + if (!_PyArg_NoStackKeywords("latin_1_decode", kwnames)) { + goto exit; + } return_value = _codecs_latin_1_decode_impl(module, &data, errors); exit: @@ -701,23 +765,27 @@ PyDoc_STRVAR(_codecs_ascii_decode__doc__, "\n"); #define _CODECS_ASCII_DECODE_METHODDEF \ - {"ascii_decode", (PyCFunction)_codecs_ascii_decode, METH_VARARGS, _codecs_ascii_decode__doc__}, + {"ascii_decode", (PyCFunction)_codecs_ascii_decode, METH_FASTCALL, _codecs_ascii_decode__doc__}, static PyObject * _codecs_ascii_decode_impl(PyObject *module, Py_buffer *data, const char *errors); static PyObject * -_codecs_ascii_decode(PyObject *module, PyObject *args) +_codecs_ascii_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "y*|z:ascii_decode", + if (!_PyArg_ParseStack(args, nargs, "y*|z:ascii_decode", &data, &errors)) { goto exit; } + + if (!_PyArg_NoStackKeywords("ascii_decode", kwnames)) { + goto exit; + } return_value = _codecs_ascii_decode_impl(module, &data, errors); exit: @@ -735,24 +803,28 @@ PyDoc_STRVAR(_codecs_charmap_decode__doc__, "\n"); #define _CODECS_CHARMAP_DECODE_METHODDEF \ - {"charmap_decode", (PyCFunction)_codecs_charmap_decode, METH_VARARGS, _codecs_charmap_decode__doc__}, + {"charmap_decode", (PyCFunction)_codecs_charmap_decode, METH_FASTCALL, _codecs_charmap_decode__doc__}, static PyObject * _codecs_charmap_decode_impl(PyObject *module, Py_buffer *data, const char *errors, PyObject *mapping); static PyObject * -_codecs_charmap_decode(PyObject *module, PyObject *args) +_codecs_charmap_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; const char *errors = NULL; PyObject *mapping = NULL; - if (!PyArg_ParseTuple(args, "y*|zO:charmap_decode", + if (!_PyArg_ParseStack(args, nargs, "y*|zO:charmap_decode", &data, &errors, &mapping)) { goto exit; } + + if (!_PyArg_NoStackKeywords("charmap_decode", kwnames)) { + goto exit; + } return_value = _codecs_charmap_decode_impl(module, &data, errors, mapping); exit: @@ -772,24 +844,28 @@ PyDoc_STRVAR(_codecs_mbcs_decode__doc__, "\n"); #define _CODECS_MBCS_DECODE_METHODDEF \ - {"mbcs_decode", (PyCFunction)_codecs_mbcs_decode, METH_VARARGS, _codecs_mbcs_decode__doc__}, + {"mbcs_decode", (PyCFunction)_codecs_mbcs_decode, METH_FASTCALL, _codecs_mbcs_decode__doc__}, static PyObject * _codecs_mbcs_decode_impl(PyObject *module, Py_buffer *data, const char *errors, int final); static PyObject * -_codecs_mbcs_decode(PyObject *module, PyObject *args) +_codecs_mbcs_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; const char *errors = NULL; int final = 0; - if (!PyArg_ParseTuple(args, "y*|zi:mbcs_decode", + if (!_PyArg_ParseStack(args, nargs, "y*|zi:mbcs_decode", &data, &errors, &final)) { goto exit; } + + if (!_PyArg_NoStackKeywords("mbcs_decode", kwnames)) { + goto exit; + } return_value = _codecs_mbcs_decode_impl(module, &data, errors, final); exit: @@ -811,24 +887,28 @@ PyDoc_STRVAR(_codecs_oem_decode__doc__, "\n"); #define _CODECS_OEM_DECODE_METHODDEF \ - {"oem_decode", (PyCFunction)_codecs_oem_decode, METH_VARARGS, _codecs_oem_decode__doc__}, + {"oem_decode", (PyCFunction)_codecs_oem_decode, METH_FASTCALL, _codecs_oem_decode__doc__}, static PyObject * _codecs_oem_decode_impl(PyObject *module, Py_buffer *data, const char *errors, int final); static PyObject * -_codecs_oem_decode(PyObject *module, PyObject *args) +_codecs_oem_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; const char *errors = NULL; int final = 0; - if (!PyArg_ParseTuple(args, "y*|zi:oem_decode", + if (!_PyArg_ParseStack(args, nargs, "y*|zi:oem_decode", &data, &errors, &final)) { goto exit; } + + if (!_PyArg_NoStackKeywords("oem_decode", kwnames)) { + goto exit; + } return_value = _codecs_oem_decode_impl(module, &data, errors, final); exit: @@ -850,14 +930,14 @@ PyDoc_STRVAR(_codecs_code_page_decode__doc__, "\n"); #define _CODECS_CODE_PAGE_DECODE_METHODDEF \ - {"code_page_decode", (PyCFunction)_codecs_code_page_decode, METH_VARARGS, _codecs_code_page_decode__doc__}, + {"code_page_decode", (PyCFunction)_codecs_code_page_decode, METH_FASTCALL, _codecs_code_page_decode__doc__}, static PyObject * _codecs_code_page_decode_impl(PyObject *module, int codepage, Py_buffer *data, const char *errors, int final); static PyObject * -_codecs_code_page_decode(PyObject *module, PyObject *args) +_codecs_code_page_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int codepage; @@ -865,10 +945,14 @@ _codecs_code_page_decode(PyObject *module, PyObject *args) const char *errors = NULL; int final = 0; - if (!PyArg_ParseTuple(args, "iy*|zi:code_page_decode", + if (!_PyArg_ParseStack(args, nargs, "iy*|zi:code_page_decode", &codepage, &data, &errors, &final)) { goto exit; } + + if (!_PyArg_NoStackKeywords("code_page_decode", kwnames)) { + goto exit; + } return_value = _codecs_code_page_decode_impl(module, codepage, &data, errors, final); exit: @@ -888,23 +972,27 @@ PyDoc_STRVAR(_codecs_readbuffer_encode__doc__, "\n"); #define _CODECS_READBUFFER_ENCODE_METHODDEF \ - {"readbuffer_encode", (PyCFunction)_codecs_readbuffer_encode, METH_VARARGS, _codecs_readbuffer_encode__doc__}, + {"readbuffer_encode", (PyCFunction)_codecs_readbuffer_encode, METH_FASTCALL, _codecs_readbuffer_encode__doc__}, static PyObject * _codecs_readbuffer_encode_impl(PyObject *module, Py_buffer *data, const char *errors); static PyObject * -_codecs_readbuffer_encode(PyObject *module, PyObject *args) +_codecs_readbuffer_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "s*|z:readbuffer_encode", + if (!_PyArg_ParseStack(args, nargs, "s*|z:readbuffer_encode", &data, &errors)) { goto exit; } + + if (!_PyArg_NoStackKeywords("readbuffer_encode", kwnames)) { + goto exit; + } return_value = _codecs_readbuffer_encode_impl(module, &data, errors); exit: @@ -922,23 +1010,27 @@ PyDoc_STRVAR(_codecs_unicode_internal_encode__doc__, "\n"); #define _CODECS_UNICODE_INTERNAL_ENCODE_METHODDEF \ - {"unicode_internal_encode", (PyCFunction)_codecs_unicode_internal_encode, METH_VARARGS, _codecs_unicode_internal_encode__doc__}, + {"unicode_internal_encode", (PyCFunction)_codecs_unicode_internal_encode, METH_FASTCALL, _codecs_unicode_internal_encode__doc__}, static PyObject * _codecs_unicode_internal_encode_impl(PyObject *module, PyObject *obj, const char *errors); static PyObject * -_codecs_unicode_internal_encode(PyObject *module, PyObject *args) +_codecs_unicode_internal_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *obj; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "O|z:unicode_internal_encode", + if (!_PyArg_ParseStack(args, nargs, "O|z:unicode_internal_encode", &obj, &errors)) { goto exit; } + + if (!_PyArg_NoStackKeywords("unicode_internal_encode", kwnames)) { + goto exit; + } return_value = _codecs_unicode_internal_encode_impl(module, obj, errors); exit: @@ -951,23 +1043,27 @@ PyDoc_STRVAR(_codecs_utf_7_encode__doc__, "\n"); #define _CODECS_UTF_7_ENCODE_METHODDEF \ - {"utf_7_encode", (PyCFunction)_codecs_utf_7_encode, METH_VARARGS, _codecs_utf_7_encode__doc__}, + {"utf_7_encode", (PyCFunction)_codecs_utf_7_encode, METH_FASTCALL, _codecs_utf_7_encode__doc__}, static PyObject * _codecs_utf_7_encode_impl(PyObject *module, PyObject *str, const char *errors); static PyObject * -_codecs_utf_7_encode(PyObject *module, PyObject *args) +_codecs_utf_7_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *str; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "U|z:utf_7_encode", + if (!_PyArg_ParseStack(args, nargs, "U|z:utf_7_encode", &str, &errors)) { goto exit; } + + if (!_PyArg_NoStackKeywords("utf_7_encode", kwnames)) { + goto exit; + } return_value = _codecs_utf_7_encode_impl(module, str, errors); exit: @@ -980,23 +1076,27 @@ PyDoc_STRVAR(_codecs_utf_8_encode__doc__, "\n"); #define _CODECS_UTF_8_ENCODE_METHODDEF \ - {"utf_8_encode", (PyCFunction)_codecs_utf_8_encode, METH_VARARGS, _codecs_utf_8_encode__doc__}, + {"utf_8_encode", (PyCFunction)_codecs_utf_8_encode, METH_FASTCALL, _codecs_utf_8_encode__doc__}, static PyObject * _codecs_utf_8_encode_impl(PyObject *module, PyObject *str, const char *errors); static PyObject * -_codecs_utf_8_encode(PyObject *module, PyObject *args) +_codecs_utf_8_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *str; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "U|z:utf_8_encode", + if (!_PyArg_ParseStack(args, nargs, "U|z:utf_8_encode", &str, &errors)) { goto exit; } + + if (!_PyArg_NoStackKeywords("utf_8_encode", kwnames)) { + goto exit; + } return_value = _codecs_utf_8_encode_impl(module, str, errors); exit: @@ -1009,24 +1109,28 @@ PyDoc_STRVAR(_codecs_utf_16_encode__doc__, "\n"); #define _CODECS_UTF_16_ENCODE_METHODDEF \ - {"utf_16_encode", (PyCFunction)_codecs_utf_16_encode, METH_VARARGS, _codecs_utf_16_encode__doc__}, + {"utf_16_encode", (PyCFunction)_codecs_utf_16_encode, METH_FASTCALL, _codecs_utf_16_encode__doc__}, static PyObject * _codecs_utf_16_encode_impl(PyObject *module, PyObject *str, const char *errors, int byteorder); static PyObject * -_codecs_utf_16_encode(PyObject *module, PyObject *args) +_codecs_utf_16_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *str; const char *errors = NULL; int byteorder = 0; - if (!PyArg_ParseTuple(args, "U|zi:utf_16_encode", + if (!_PyArg_ParseStack(args, nargs, "U|zi:utf_16_encode", &str, &errors, &byteorder)) { goto exit; } + + if (!_PyArg_NoStackKeywords("utf_16_encode", kwnames)) { + goto exit; + } return_value = _codecs_utf_16_encode_impl(module, str, errors, byteorder); exit: @@ -1039,23 +1143,27 @@ PyDoc_STRVAR(_codecs_utf_16_le_encode__doc__, "\n"); #define _CODECS_UTF_16_LE_ENCODE_METHODDEF \ - {"utf_16_le_encode", (PyCFunction)_codecs_utf_16_le_encode, METH_VARARGS, _codecs_utf_16_le_encode__doc__}, + {"utf_16_le_encode", (PyCFunction)_codecs_utf_16_le_encode, METH_FASTCALL, _codecs_utf_16_le_encode__doc__}, static PyObject * _codecs_utf_16_le_encode_impl(PyObject *module, PyObject *str, const char *errors); static PyObject * -_codecs_utf_16_le_encode(PyObject *module, PyObject *args) +_codecs_utf_16_le_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *str; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "U|z:utf_16_le_encode", + if (!_PyArg_ParseStack(args, nargs, "U|z:utf_16_le_encode", &str, &errors)) { goto exit; } + + if (!_PyArg_NoStackKeywords("utf_16_le_encode", kwnames)) { + goto exit; + } return_value = _codecs_utf_16_le_encode_impl(module, str, errors); exit: @@ -1068,23 +1176,27 @@ PyDoc_STRVAR(_codecs_utf_16_be_encode__doc__, "\n"); #define _CODECS_UTF_16_BE_ENCODE_METHODDEF \ - {"utf_16_be_encode", (PyCFunction)_codecs_utf_16_be_encode, METH_VARARGS, _codecs_utf_16_be_encode__doc__}, + {"utf_16_be_encode", (PyCFunction)_codecs_utf_16_be_encode, METH_FASTCALL, _codecs_utf_16_be_encode__doc__}, static PyObject * _codecs_utf_16_be_encode_impl(PyObject *module, PyObject *str, const char *errors); static PyObject * -_codecs_utf_16_be_encode(PyObject *module, PyObject *args) +_codecs_utf_16_be_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *str; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "U|z:utf_16_be_encode", + if (!_PyArg_ParseStack(args, nargs, "U|z:utf_16_be_encode", &str, &errors)) { goto exit; } + + if (!_PyArg_NoStackKeywords("utf_16_be_encode", kwnames)) { + goto exit; + } return_value = _codecs_utf_16_be_encode_impl(module, str, errors); exit: @@ -1097,24 +1209,28 @@ PyDoc_STRVAR(_codecs_utf_32_encode__doc__, "\n"); #define _CODECS_UTF_32_ENCODE_METHODDEF \ - {"utf_32_encode", (PyCFunction)_codecs_utf_32_encode, METH_VARARGS, _codecs_utf_32_encode__doc__}, + {"utf_32_encode", (PyCFunction)_codecs_utf_32_encode, METH_FASTCALL, _codecs_utf_32_encode__doc__}, static PyObject * _codecs_utf_32_encode_impl(PyObject *module, PyObject *str, const char *errors, int byteorder); static PyObject * -_codecs_utf_32_encode(PyObject *module, PyObject *args) +_codecs_utf_32_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *str; const char *errors = NULL; int byteorder = 0; - if (!PyArg_ParseTuple(args, "U|zi:utf_32_encode", + if (!_PyArg_ParseStack(args, nargs, "U|zi:utf_32_encode", &str, &errors, &byteorder)) { goto exit; } + + if (!_PyArg_NoStackKeywords("utf_32_encode", kwnames)) { + goto exit; + } return_value = _codecs_utf_32_encode_impl(module, str, errors, byteorder); exit: @@ -1127,23 +1243,27 @@ PyDoc_STRVAR(_codecs_utf_32_le_encode__doc__, "\n"); #define _CODECS_UTF_32_LE_ENCODE_METHODDEF \ - {"utf_32_le_encode", (PyCFunction)_codecs_utf_32_le_encode, METH_VARARGS, _codecs_utf_32_le_encode__doc__}, + {"utf_32_le_encode", (PyCFunction)_codecs_utf_32_le_encode, METH_FASTCALL, _codecs_utf_32_le_encode__doc__}, static PyObject * _codecs_utf_32_le_encode_impl(PyObject *module, PyObject *str, const char *errors); static PyObject * -_codecs_utf_32_le_encode(PyObject *module, PyObject *args) +_codecs_utf_32_le_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *str; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "U|z:utf_32_le_encode", + if (!_PyArg_ParseStack(args, nargs, "U|z:utf_32_le_encode", &str, &errors)) { goto exit; } + + if (!_PyArg_NoStackKeywords("utf_32_le_encode", kwnames)) { + goto exit; + } return_value = _codecs_utf_32_le_encode_impl(module, str, errors); exit: @@ -1156,23 +1276,27 @@ PyDoc_STRVAR(_codecs_utf_32_be_encode__doc__, "\n"); #define _CODECS_UTF_32_BE_ENCODE_METHODDEF \ - {"utf_32_be_encode", (PyCFunction)_codecs_utf_32_be_encode, METH_VARARGS, _codecs_utf_32_be_encode__doc__}, + {"utf_32_be_encode", (PyCFunction)_codecs_utf_32_be_encode, METH_FASTCALL, _codecs_utf_32_be_encode__doc__}, static PyObject * _codecs_utf_32_be_encode_impl(PyObject *module, PyObject *str, const char *errors); static PyObject * -_codecs_utf_32_be_encode(PyObject *module, PyObject *args) +_codecs_utf_32_be_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *str; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "U|z:utf_32_be_encode", + if (!_PyArg_ParseStack(args, nargs, "U|z:utf_32_be_encode", &str, &errors)) { goto exit; } + + if (!_PyArg_NoStackKeywords("utf_32_be_encode", kwnames)) { + goto exit; + } return_value = _codecs_utf_32_be_encode_impl(module, str, errors); exit: @@ -1185,23 +1309,27 @@ PyDoc_STRVAR(_codecs_unicode_escape_encode__doc__, "\n"); #define _CODECS_UNICODE_ESCAPE_ENCODE_METHODDEF \ - {"unicode_escape_encode", (PyCFunction)_codecs_unicode_escape_encode, METH_VARARGS, _codecs_unicode_escape_encode__doc__}, + {"unicode_escape_encode", (PyCFunction)_codecs_unicode_escape_encode, METH_FASTCALL, _codecs_unicode_escape_encode__doc__}, static PyObject * _codecs_unicode_escape_encode_impl(PyObject *module, PyObject *str, const char *errors); static PyObject * -_codecs_unicode_escape_encode(PyObject *module, PyObject *args) +_codecs_unicode_escape_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *str; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "U|z:unicode_escape_encode", + if (!_PyArg_ParseStack(args, nargs, "U|z:unicode_escape_encode", &str, &errors)) { goto exit; } + + if (!_PyArg_NoStackKeywords("unicode_escape_encode", kwnames)) { + goto exit; + } return_value = _codecs_unicode_escape_encode_impl(module, str, errors); exit: @@ -1214,23 +1342,27 @@ PyDoc_STRVAR(_codecs_raw_unicode_escape_encode__doc__, "\n"); #define _CODECS_RAW_UNICODE_ESCAPE_ENCODE_METHODDEF \ - {"raw_unicode_escape_encode", (PyCFunction)_codecs_raw_unicode_escape_encode, METH_VARARGS, _codecs_raw_unicode_escape_encode__doc__}, + {"raw_unicode_escape_encode", (PyCFunction)_codecs_raw_unicode_escape_encode, METH_FASTCALL, _codecs_raw_unicode_escape_encode__doc__}, static PyObject * _codecs_raw_unicode_escape_encode_impl(PyObject *module, PyObject *str, const char *errors); static PyObject * -_codecs_raw_unicode_escape_encode(PyObject *module, PyObject *args) +_codecs_raw_unicode_escape_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *str; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "U|z:raw_unicode_escape_encode", + if (!_PyArg_ParseStack(args, nargs, "U|z:raw_unicode_escape_encode", &str, &errors)) { goto exit; } + + if (!_PyArg_NoStackKeywords("raw_unicode_escape_encode", kwnames)) { + goto exit; + } return_value = _codecs_raw_unicode_escape_encode_impl(module, str, errors); exit: @@ -1243,23 +1375,27 @@ PyDoc_STRVAR(_codecs_latin_1_encode__doc__, "\n"); #define _CODECS_LATIN_1_ENCODE_METHODDEF \ - {"latin_1_encode", (PyCFunction)_codecs_latin_1_encode, METH_VARARGS, _codecs_latin_1_encode__doc__}, + {"latin_1_encode", (PyCFunction)_codecs_latin_1_encode, METH_FASTCALL, _codecs_latin_1_encode__doc__}, static PyObject * _codecs_latin_1_encode_impl(PyObject *module, PyObject *str, const char *errors); static PyObject * -_codecs_latin_1_encode(PyObject *module, PyObject *args) +_codecs_latin_1_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *str; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "U|z:latin_1_encode", + if (!_PyArg_ParseStack(args, nargs, "U|z:latin_1_encode", &str, &errors)) { goto exit; } + + if (!_PyArg_NoStackKeywords("latin_1_encode", kwnames)) { + goto exit; + } return_value = _codecs_latin_1_encode_impl(module, str, errors); exit: @@ -1272,23 +1408,27 @@ PyDoc_STRVAR(_codecs_ascii_encode__doc__, "\n"); #define _CODECS_ASCII_ENCODE_METHODDEF \ - {"ascii_encode", (PyCFunction)_codecs_ascii_encode, METH_VARARGS, _codecs_ascii_encode__doc__}, + {"ascii_encode", (PyCFunction)_codecs_ascii_encode, METH_FASTCALL, _codecs_ascii_encode__doc__}, static PyObject * _codecs_ascii_encode_impl(PyObject *module, PyObject *str, const char *errors); static PyObject * -_codecs_ascii_encode(PyObject *module, PyObject *args) +_codecs_ascii_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *str; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "U|z:ascii_encode", + if (!_PyArg_ParseStack(args, nargs, "U|z:ascii_encode", &str, &errors)) { goto exit; } + + if (!_PyArg_NoStackKeywords("ascii_encode", kwnames)) { + goto exit; + } return_value = _codecs_ascii_encode_impl(module, str, errors); exit: @@ -1301,24 +1441,28 @@ PyDoc_STRVAR(_codecs_charmap_encode__doc__, "\n"); #define _CODECS_CHARMAP_ENCODE_METHODDEF \ - {"charmap_encode", (PyCFunction)_codecs_charmap_encode, METH_VARARGS, _codecs_charmap_encode__doc__}, + {"charmap_encode", (PyCFunction)_codecs_charmap_encode, METH_FASTCALL, _codecs_charmap_encode__doc__}, static PyObject * _codecs_charmap_encode_impl(PyObject *module, PyObject *str, const char *errors, PyObject *mapping); static PyObject * -_codecs_charmap_encode(PyObject *module, PyObject *args) +_codecs_charmap_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *str; const char *errors = NULL; PyObject *mapping = NULL; - if (!PyArg_ParseTuple(args, "U|zO:charmap_encode", + if (!_PyArg_ParseStack(args, nargs, "U|zO:charmap_encode", &str, &errors, &mapping)) { goto exit; } + + if (!_PyArg_NoStackKeywords("charmap_encode", kwnames)) { + goto exit; + } return_value = _codecs_charmap_encode_impl(module, str, errors, mapping); exit: @@ -1359,22 +1503,26 @@ PyDoc_STRVAR(_codecs_mbcs_encode__doc__, "\n"); #define _CODECS_MBCS_ENCODE_METHODDEF \ - {"mbcs_encode", (PyCFunction)_codecs_mbcs_encode, METH_VARARGS, _codecs_mbcs_encode__doc__}, + {"mbcs_encode", (PyCFunction)_codecs_mbcs_encode, METH_FASTCALL, _codecs_mbcs_encode__doc__}, static PyObject * _codecs_mbcs_encode_impl(PyObject *module, PyObject *str, const char *errors); static PyObject * -_codecs_mbcs_encode(PyObject *module, PyObject *args) +_codecs_mbcs_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *str; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "U|z:mbcs_encode", + if (!_PyArg_ParseStack(args, nargs, "U|z:mbcs_encode", &str, &errors)) { goto exit; } + + if (!_PyArg_NoStackKeywords("mbcs_encode", kwnames)) { + goto exit; + } return_value = _codecs_mbcs_encode_impl(module, str, errors); exit: @@ -1391,22 +1539,26 @@ PyDoc_STRVAR(_codecs_oem_encode__doc__, "\n"); #define _CODECS_OEM_ENCODE_METHODDEF \ - {"oem_encode", (PyCFunction)_codecs_oem_encode, METH_VARARGS, _codecs_oem_encode__doc__}, + {"oem_encode", (PyCFunction)_codecs_oem_encode, METH_FASTCALL, _codecs_oem_encode__doc__}, static PyObject * _codecs_oem_encode_impl(PyObject *module, PyObject *str, const char *errors); static PyObject * -_codecs_oem_encode(PyObject *module, PyObject *args) +_codecs_oem_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *str; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "U|z:oem_encode", + if (!_PyArg_ParseStack(args, nargs, "U|z:oem_encode", &str, &errors)) { goto exit; } + + if (!_PyArg_NoStackKeywords("oem_encode", kwnames)) { + goto exit; + } return_value = _codecs_oem_encode_impl(module, str, errors); exit: @@ -1423,24 +1575,28 @@ PyDoc_STRVAR(_codecs_code_page_encode__doc__, "\n"); #define _CODECS_CODE_PAGE_ENCODE_METHODDEF \ - {"code_page_encode", (PyCFunction)_codecs_code_page_encode, METH_VARARGS, _codecs_code_page_encode__doc__}, + {"code_page_encode", (PyCFunction)_codecs_code_page_encode, METH_FASTCALL, _codecs_code_page_encode__doc__}, static PyObject * _codecs_code_page_encode_impl(PyObject *module, int code_page, PyObject *str, const char *errors); static PyObject * -_codecs_code_page_encode(PyObject *module, PyObject *args) +_codecs_code_page_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int code_page; PyObject *str; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "iU|z:code_page_encode", + if (!_PyArg_ParseStack(args, nargs, "iU|z:code_page_encode", &code_page, &str, &errors)) { goto exit; } + + if (!_PyArg_NoStackKeywords("code_page_encode", kwnames)) { + goto exit; + } return_value = _codecs_code_page_encode_impl(module, code_page, str, errors); exit: @@ -1460,23 +1616,27 @@ PyDoc_STRVAR(_codecs_register_error__doc__, "error and must return a (replacement, new position) tuple."); #define _CODECS_REGISTER_ERROR_METHODDEF \ - {"register_error", (PyCFunction)_codecs_register_error, METH_VARARGS, _codecs_register_error__doc__}, + {"register_error", (PyCFunction)_codecs_register_error, METH_FASTCALL, _codecs_register_error__doc__}, static PyObject * _codecs_register_error_impl(PyObject *module, const char *errors, PyObject *handler); static PyObject * -_codecs_register_error(PyObject *module, PyObject *args) +_codecs_register_error(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; const char *errors; PyObject *handler; - if (!PyArg_ParseTuple(args, "sO:register_error", + if (!_PyArg_ParseStack(args, nargs, "sO:register_error", &errors, &handler)) { goto exit; } + + if (!_PyArg_NoStackKeywords("register_error", kwnames)) { + goto exit; + } return_value = _codecs_register_error_impl(module, errors, handler); exit: @@ -1536,4 +1696,4 @@ exit: #ifndef _CODECS_CODE_PAGE_ENCODE_METHODDEF #define _CODECS_CODE_PAGE_ENCODE_METHODDEF #endif /* !defined(_CODECS_CODE_PAGE_ENCODE_METHODDEF) */ -/*[clinic end generated code: output=6d6afcabde10ed79 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=36fb42f450a3b4dc input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_cryptmodule.c.h b/Modules/clinic/_cryptmodule.c.h index 412c6fe8a1..3e536c1709 100644 --- a/Modules/clinic/_cryptmodule.c.h +++ b/Modules/clinic/_cryptmodule.c.h @@ -14,25 +14,29 @@ PyDoc_STRVAR(crypt_crypt__doc__, "results for a given *word*."); #define CRYPT_CRYPT_METHODDEF \ - {"crypt", (PyCFunction)crypt_crypt, METH_VARARGS, crypt_crypt__doc__}, + {"crypt", (PyCFunction)crypt_crypt, METH_FASTCALL, crypt_crypt__doc__}, static PyObject * crypt_crypt_impl(PyObject *module, const char *word, const char *salt); static PyObject * -crypt_crypt(PyObject *module, PyObject *args) +crypt_crypt(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; const char *word; const char *salt; - if (!PyArg_ParseTuple(args, "ss:crypt", + if (!_PyArg_ParseStack(args, nargs, "ss:crypt", &word, &salt)) { goto exit; } + + if (!_PyArg_NoStackKeywords("crypt", kwnames)) { + goto exit; + } return_value = crypt_crypt_impl(module, word, salt); exit: return return_value; } -/*[clinic end generated code: output=8dfc88264e662df4 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=3fd5d3625a6f32fe input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_datetimemodule.c.h b/Modules/clinic/_datetimemodule.c.h index dcb992b1af..1ffe1337a6 100644 --- a/Modules/clinic/_datetimemodule.c.h +++ b/Modules/clinic/_datetimemodule.c.h @@ -27,7 +27,7 @@ datetime_datetime_now(PyTypeObject *type, PyObject **args, Py_ssize_t nargs, PyO static _PyArg_Parser _parser = {"|O:now", _keywords, 0}; PyObject *tz = Py_None; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &tz)) { goto exit; } @@ -36,4 +36,4 @@ datetime_datetime_now(PyTypeObject *type, PyObject **args, Py_ssize_t nargs, PyO exit: return return_value; } -/*[clinic end generated code: output=8aaac0705add61ca input=a9049054013a1b77]*/ +/*[clinic end generated code: output=ff78f2f51687e9a9 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_dbmmodule.c.h b/Modules/clinic/_dbmmodule.c.h index 06cf7e6741..06f0b04977 100644 --- a/Modules/clinic/_dbmmodule.c.h +++ b/Modules/clinic/_dbmmodule.c.h @@ -45,24 +45,28 @@ PyDoc_STRVAR(_dbm_dbm_get__doc__, "Return the value for key if present, otherwise default."); #define _DBM_DBM_GET_METHODDEF \ - {"get", (PyCFunction)_dbm_dbm_get, METH_VARARGS, _dbm_dbm_get__doc__}, + {"get", (PyCFunction)_dbm_dbm_get, METH_FASTCALL, _dbm_dbm_get__doc__}, static PyObject * _dbm_dbm_get_impl(dbmobject *self, const char *key, Py_ssize_clean_t key_length, PyObject *default_value); static PyObject * -_dbm_dbm_get(dbmobject *self, PyObject *args) +_dbm_dbm_get(dbmobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; const char *key; Py_ssize_clean_t key_length; PyObject *default_value = NULL; - if (!PyArg_ParseTuple(args, "s#|O:get", + if (!_PyArg_ParseStack(args, nargs, "s#|O:get", &key, &key_length, &default_value)) { goto exit; } + + if (!_PyArg_NoStackKeywords("get", kwnames)) { + goto exit; + } return_value = _dbm_dbm_get_impl(self, key, key_length, default_value); exit: @@ -78,7 +82,7 @@ PyDoc_STRVAR(_dbm_dbm_setdefault__doc__, "If key is not in the database, it is inserted with default as the value."); #define _DBM_DBM_SETDEFAULT_METHODDEF \ - {"setdefault", (PyCFunction)_dbm_dbm_setdefault, METH_VARARGS, _dbm_dbm_setdefault__doc__}, + {"setdefault", (PyCFunction)_dbm_dbm_setdefault, METH_FASTCALL, _dbm_dbm_setdefault__doc__}, static PyObject * _dbm_dbm_setdefault_impl(dbmobject *self, const char *key, @@ -86,17 +90,21 @@ _dbm_dbm_setdefault_impl(dbmobject *self, const char *key, PyObject *default_value); static PyObject * -_dbm_dbm_setdefault(dbmobject *self, PyObject *args) +_dbm_dbm_setdefault(dbmobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; const char *key; Py_ssize_clean_t key_length; PyObject *default_value = NULL; - if (!PyArg_ParseTuple(args, "s#|O:setdefault", + if (!_PyArg_ParseStack(args, nargs, "s#|O:setdefault", &key, &key_length, &default_value)) { goto exit; } + + if (!_PyArg_NoStackKeywords("setdefault", kwnames)) { + goto exit; + } return_value = _dbm_dbm_setdefault_impl(self, key, key_length, default_value); exit: @@ -118,27 +126,31 @@ PyDoc_STRVAR(dbmopen__doc__, " (e.g. os.O_RDWR)."); #define DBMOPEN_METHODDEF \ - {"open", (PyCFunction)dbmopen, METH_VARARGS, dbmopen__doc__}, + {"open", (PyCFunction)dbmopen, METH_FASTCALL, dbmopen__doc__}, static PyObject * dbmopen_impl(PyObject *module, const char *filename, const char *flags, int mode); static PyObject * -dbmopen(PyObject *module, PyObject *args) +dbmopen(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; const char *filename; const char *flags = "r"; int mode = 438; - if (!PyArg_ParseTuple(args, "s|si:open", + if (!_PyArg_ParseStack(args, nargs, "s|si:open", &filename, &flags, &mode)) { goto exit; } + + if (!_PyArg_NoStackKeywords("open", kwnames)) { + goto exit; + } return_value = dbmopen_impl(module, filename, flags, mode); exit: return return_value; } -/*[clinic end generated code: output=99adf966ef0475ff input=a9049054013a1b77]*/ +/*[clinic end generated code: output=4fdb7be8bd03cbce input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_elementtree.c.h b/Modules/clinic/_elementtree.c.h index 1b309cd88c..c13cb35c70 100644 --- a/Modules/clinic/_elementtree.c.h +++ b/Modules/clinic/_elementtree.c.h @@ -151,7 +151,7 @@ _elementtree_Element_find(ElementObject *self, PyObject **args, Py_ssize_t nargs PyObject *path; PyObject *namespaces = Py_None; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &path, &namespaces)) { goto exit; } @@ -184,7 +184,7 @@ _elementtree_Element_findtext(ElementObject *self, PyObject **args, Py_ssize_t n PyObject *default_value = Py_None; PyObject *namespaces = Py_None; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &path, &default_value, &namespaces)) { goto exit; } @@ -215,7 +215,7 @@ _elementtree_Element_findall(ElementObject *self, PyObject **args, Py_ssize_t na PyObject *path; PyObject *namespaces = Py_None; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &path, &namespaces)) { goto exit; } @@ -246,7 +246,7 @@ _elementtree_Element_iterfind(ElementObject *self, PyObject **args, Py_ssize_t n PyObject *path; PyObject *namespaces = Py_None; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &path, &namespaces)) { goto exit; } @@ -277,7 +277,7 @@ _elementtree_Element_get(ElementObject *self, PyObject **args, Py_ssize_t nargs, PyObject *key; PyObject *default_value = Py_None; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &key, &default_value)) { goto exit; } @@ -323,7 +323,7 @@ _elementtree_Element_iter(ElementObject *self, PyObject **args, Py_ssize_t nargs static _PyArg_Parser _parser = {"|O:iter", _keywords, 0}; PyObject *tag = Py_None; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &tag)) { goto exit; } @@ -356,23 +356,27 @@ PyDoc_STRVAR(_elementtree_Element_insert__doc__, "\n"); #define _ELEMENTTREE_ELEMENT_INSERT_METHODDEF \ - {"insert", (PyCFunction)_elementtree_Element_insert, METH_VARARGS, _elementtree_Element_insert__doc__}, + {"insert", (PyCFunction)_elementtree_Element_insert, METH_FASTCALL, _elementtree_Element_insert__doc__}, static PyObject * _elementtree_Element_insert_impl(ElementObject *self, Py_ssize_t index, PyObject *subelement); static PyObject * -_elementtree_Element_insert(ElementObject *self, PyObject *args) +_elementtree_Element_insert(ElementObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_ssize_t index; PyObject *subelement; - if (!PyArg_ParseTuple(args, "nO!:insert", + if (!_PyArg_ParseStack(args, nargs, "nO!:insert", &index, &Element_Type, &subelement)) { goto exit; } + + if (!_PyArg_NoStackKeywords("insert", kwnames)) { + goto exit; + } return_value = _elementtree_Element_insert_impl(self, index, subelement); exit: @@ -419,24 +423,28 @@ PyDoc_STRVAR(_elementtree_Element_makeelement__doc__, "\n"); #define _ELEMENTTREE_ELEMENT_MAKEELEMENT_METHODDEF \ - {"makeelement", (PyCFunction)_elementtree_Element_makeelement, METH_VARARGS, _elementtree_Element_makeelement__doc__}, + {"makeelement", (PyCFunction)_elementtree_Element_makeelement, METH_FASTCALL, _elementtree_Element_makeelement__doc__}, static PyObject * _elementtree_Element_makeelement_impl(ElementObject *self, PyObject *tag, PyObject *attrib); static PyObject * -_elementtree_Element_makeelement(ElementObject *self, PyObject *args) +_elementtree_Element_makeelement(ElementObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *tag; PyObject *attrib; - if (!PyArg_UnpackTuple(args, "makeelement", + if (!_PyArg_UnpackStack(args, nargs, "makeelement", 2, 2, &tag, &attrib)) { goto exit; } + + if (!_PyArg_NoStackKeywords("makeelement", kwnames)) { + goto exit; + } return_value = _elementtree_Element_makeelement_impl(self, tag, attrib); exit: @@ -475,24 +483,28 @@ PyDoc_STRVAR(_elementtree_Element_set__doc__, "\n"); #define _ELEMENTTREE_ELEMENT_SET_METHODDEF \ - {"set", (PyCFunction)_elementtree_Element_set, METH_VARARGS, _elementtree_Element_set__doc__}, + {"set", (PyCFunction)_elementtree_Element_set, METH_FASTCALL, _elementtree_Element_set__doc__}, static PyObject * _elementtree_Element_set_impl(ElementObject *self, PyObject *key, PyObject *value); static PyObject * -_elementtree_Element_set(ElementObject *self, PyObject *args) +_elementtree_Element_set(ElementObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *key; PyObject *value; - if (!PyArg_UnpackTuple(args, "set", + if (!_PyArg_UnpackStack(args, nargs, "set", 2, 2, &key, &value)) { goto exit; } + + if (!_PyArg_NoStackKeywords("set", kwnames)) { + goto exit; + } return_value = _elementtree_Element_set_impl(self, key, value); exit: @@ -560,24 +572,28 @@ PyDoc_STRVAR(_elementtree_TreeBuilder_start__doc__, "\n"); #define _ELEMENTTREE_TREEBUILDER_START_METHODDEF \ - {"start", (PyCFunction)_elementtree_TreeBuilder_start, METH_VARARGS, _elementtree_TreeBuilder_start__doc__}, + {"start", (PyCFunction)_elementtree_TreeBuilder_start, METH_FASTCALL, _elementtree_TreeBuilder_start__doc__}, static PyObject * _elementtree_TreeBuilder_start_impl(TreeBuilderObject *self, PyObject *tag, PyObject *attrs); static PyObject * -_elementtree_TreeBuilder_start(TreeBuilderObject *self, PyObject *args) +_elementtree_TreeBuilder_start(TreeBuilderObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *tag; PyObject *attrs = Py_None; - if (!PyArg_UnpackTuple(args, "start", + if (!_PyArg_UnpackStack(args, nargs, "start", 1, 2, &tag, &attrs)) { goto exit; } + + if (!_PyArg_NoStackKeywords("start", kwnames)) { + goto exit; + } return_value = _elementtree_TreeBuilder_start_impl(self, tag, attrs); exit: @@ -647,25 +663,29 @@ PyDoc_STRVAR(_elementtree_XMLParser_doctype__doc__, "\n"); #define _ELEMENTTREE_XMLPARSER_DOCTYPE_METHODDEF \ - {"doctype", (PyCFunction)_elementtree_XMLParser_doctype, METH_VARARGS, _elementtree_XMLParser_doctype__doc__}, + {"doctype", (PyCFunction)_elementtree_XMLParser_doctype, METH_FASTCALL, _elementtree_XMLParser_doctype__doc__}, static PyObject * _elementtree_XMLParser_doctype_impl(XMLParserObject *self, PyObject *name, PyObject *pubid, PyObject *system); static PyObject * -_elementtree_XMLParser_doctype(XMLParserObject *self, PyObject *args) +_elementtree_XMLParser_doctype(XMLParserObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *name; PyObject *pubid; PyObject *system; - if (!PyArg_UnpackTuple(args, "doctype", + if (!_PyArg_UnpackStack(args, nargs, "doctype", 3, 3, &name, &pubid, &system)) { goto exit; } + + if (!_PyArg_NoStackKeywords("doctype", kwnames)) { + goto exit; + } return_value = _elementtree_XMLParser_doctype_impl(self, name, pubid, system); exit: @@ -678,7 +698,7 @@ PyDoc_STRVAR(_elementtree_XMLParser__setevents__doc__, "\n"); #define _ELEMENTTREE_XMLPARSER__SETEVENTS_METHODDEF \ - {"_setevents", (PyCFunction)_elementtree_XMLParser__setevents, METH_VARARGS, _elementtree_XMLParser__setevents__doc__}, + {"_setevents", (PyCFunction)_elementtree_XMLParser__setevents, METH_FASTCALL, _elementtree_XMLParser__setevents__doc__}, static PyObject * _elementtree_XMLParser__setevents_impl(XMLParserObject *self, @@ -686,20 +706,24 @@ _elementtree_XMLParser__setevents_impl(XMLParserObject *self, PyObject *events_to_report); static PyObject * -_elementtree_XMLParser__setevents(XMLParserObject *self, PyObject *args) +_elementtree_XMLParser__setevents(XMLParserObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *events_queue; PyObject *events_to_report = Py_None; - if (!PyArg_UnpackTuple(args, "_setevents", + if (!_PyArg_UnpackStack(args, nargs, "_setevents", 1, 2, &events_queue, &events_to_report)) { goto exit; } + + if (!_PyArg_NoStackKeywords("_setevents", kwnames)) { + goto exit; + } return_value = _elementtree_XMLParser__setevents_impl(self, events_queue, events_to_report); exit: return return_value; } -/*[clinic end generated code: output=b4a571a98ced3163 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=b69fa98c40917f58 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_gdbmmodule.c.h b/Modules/clinic/_gdbmmodule.c.h index fdd589c07a..b91cea109f 100644 --- a/Modules/clinic/_gdbmmodule.c.h +++ b/Modules/clinic/_gdbmmodule.c.h @@ -9,23 +9,27 @@ PyDoc_STRVAR(_gdbm_gdbm_get__doc__, "Get the value for key, or default if not present."); #define _GDBM_GDBM_GET_METHODDEF \ - {"get", (PyCFunction)_gdbm_gdbm_get, METH_VARARGS, _gdbm_gdbm_get__doc__}, + {"get", (PyCFunction)_gdbm_gdbm_get, METH_FASTCALL, _gdbm_gdbm_get__doc__}, static PyObject * _gdbm_gdbm_get_impl(dbmobject *self, PyObject *key, PyObject *default_value); static PyObject * -_gdbm_gdbm_get(dbmobject *self, PyObject *args) +_gdbm_gdbm_get(dbmobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *key; PyObject *default_value = Py_None; - if (!PyArg_UnpackTuple(args, "get", + if (!_PyArg_UnpackStack(args, nargs, "get", 1, 2, &key, &default_value)) { goto exit; } + + if (!_PyArg_NoStackKeywords("get", kwnames)) { + goto exit; + } return_value = _gdbm_gdbm_get_impl(self, key, default_value); exit: @@ -39,24 +43,28 @@ PyDoc_STRVAR(_gdbm_gdbm_setdefault__doc__, "Get value for key, or set it to default and return default if not present."); #define _GDBM_GDBM_SETDEFAULT_METHODDEF \ - {"setdefault", (PyCFunction)_gdbm_gdbm_setdefault, METH_VARARGS, _gdbm_gdbm_setdefault__doc__}, + {"setdefault", (PyCFunction)_gdbm_gdbm_setdefault, METH_FASTCALL, _gdbm_gdbm_setdefault__doc__}, static PyObject * _gdbm_gdbm_setdefault_impl(dbmobject *self, PyObject *key, PyObject *default_value); static PyObject * -_gdbm_gdbm_setdefault(dbmobject *self, PyObject *args) +_gdbm_gdbm_setdefault(dbmobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *key; PyObject *default_value = Py_None; - if (!PyArg_UnpackTuple(args, "setdefault", + if (!_PyArg_UnpackStack(args, nargs, "setdefault", 1, 2, &key, &default_value)) { goto exit; } + + if (!_PyArg_NoStackKeywords("setdefault", kwnames)) { + goto exit; + } return_value = _gdbm_gdbm_setdefault_impl(self, key, default_value); exit: @@ -231,26 +239,30 @@ PyDoc_STRVAR(dbmopen__doc__, "when the database has to be created. It defaults to octal 0o666."); #define DBMOPEN_METHODDEF \ - {"open", (PyCFunction)dbmopen, METH_VARARGS, dbmopen__doc__}, + {"open", (PyCFunction)dbmopen, METH_FASTCALL, dbmopen__doc__}, static PyObject * dbmopen_impl(PyObject *module, const char *name, const char *flags, int mode); static PyObject * -dbmopen(PyObject *module, PyObject *args) +dbmopen(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; const char *name; const char *flags = "r"; int mode = 438; - if (!PyArg_ParseTuple(args, "s|si:open", + if (!_PyArg_ParseStack(args, nargs, "s|si:open", &name, &flags, &mode)) { goto exit; } + + if (!_PyArg_NoStackKeywords("open", kwnames)) { + goto exit; + } return_value = dbmopen_impl(module, name, flags, mode); exit: return return_value; } -/*[clinic end generated code: output=ed0f5d4e3d79b80c input=a9049054013a1b77]*/ +/*[clinic end generated code: output=03a3a63a814ada93 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_hashopenssl.c.h b/Modules/clinic/_hashopenssl.c.h index 0445352604..572600a224 100644 --- a/Modules/clinic/_hashopenssl.c.h +++ b/Modules/clinic/_hashopenssl.c.h @@ -33,7 +33,7 @@ _hashlib_scrypt(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *k long maxmem = 0; long dklen = 64; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &password, &salt, &PyLong_Type, &n_obj, &PyLong_Type, &r_obj, &PyLong_Type, &p_obj, &maxmem, &dklen)) { goto exit; } @@ -57,4 +57,4 @@ exit: #ifndef _HASHLIB_SCRYPT_METHODDEF #define _HASHLIB_SCRYPT_METHODDEF #endif /* !defined(_HASHLIB_SCRYPT_METHODDEF) */ -/*[clinic end generated code: output=118cd7036fa0fb52 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=71f1e033efe4ac9a input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_lzmamodule.c.h b/Modules/clinic/_lzmamodule.c.h index 9e6075954a..a3b1ad5c6c 100644 --- a/Modules/clinic/_lzmamodule.c.h +++ b/Modules/clinic/_lzmamodule.c.h @@ -96,7 +96,7 @@ _lzma_LZMADecompressor_decompress(Decompressor *self, PyObject **args, Py_ssize_ Py_buffer data = {NULL, NULL}; Py_ssize_t max_length = -1; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &data, &max_length)) { goto exit; } @@ -229,23 +229,27 @@ PyDoc_STRVAR(_lzma__decode_filter_properties__doc__, "The result does not include the filter ID itself, only the options."); #define _LZMA__DECODE_FILTER_PROPERTIES_METHODDEF \ - {"_decode_filter_properties", (PyCFunction)_lzma__decode_filter_properties, METH_VARARGS, _lzma__decode_filter_properties__doc__}, + {"_decode_filter_properties", (PyCFunction)_lzma__decode_filter_properties, METH_FASTCALL, _lzma__decode_filter_properties__doc__}, static PyObject * _lzma__decode_filter_properties_impl(PyObject *module, lzma_vli filter_id, Py_buffer *encoded_props); static PyObject * -_lzma__decode_filter_properties(PyObject *module, PyObject *args) +_lzma__decode_filter_properties(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; lzma_vli filter_id; Py_buffer encoded_props = {NULL, NULL}; - if (!PyArg_ParseTuple(args, "O&y*:_decode_filter_properties", + if (!_PyArg_ParseStack(args, nargs, "O&y*:_decode_filter_properties", lzma_vli_converter, &filter_id, &encoded_props)) { goto exit; } + + if (!_PyArg_NoStackKeywords("_decode_filter_properties", kwnames)) { + goto exit; + } return_value = _lzma__decode_filter_properties_impl(module, filter_id, &encoded_props); exit: @@ -256,4 +260,4 @@ exit: return return_value; } -/*[clinic end generated code: output=f27abae460122706 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=5f7a915fb7e41453 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_opcode.c.h b/Modules/clinic/_opcode.c.h index 513cbfdad8..77f31d9b5f 100644 --- a/Modules/clinic/_opcode.c.h +++ b/Modules/clinic/_opcode.c.h @@ -9,23 +9,27 @@ PyDoc_STRVAR(_opcode_stack_effect__doc__, "Compute the stack effect of the opcode."); #define _OPCODE_STACK_EFFECT_METHODDEF \ - {"stack_effect", (PyCFunction)_opcode_stack_effect, METH_VARARGS, _opcode_stack_effect__doc__}, + {"stack_effect", (PyCFunction)_opcode_stack_effect, METH_FASTCALL, _opcode_stack_effect__doc__}, static int _opcode_stack_effect_impl(PyObject *module, int opcode, PyObject *oparg); static PyObject * -_opcode_stack_effect(PyObject *module, PyObject *args) +_opcode_stack_effect(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int opcode; PyObject *oparg = Py_None; int _return_value; - if (!PyArg_ParseTuple(args, "i|O:stack_effect", + if (!_PyArg_ParseStack(args, nargs, "i|O:stack_effect", &opcode, &oparg)) { goto exit; } + + if (!_PyArg_NoStackKeywords("stack_effect", kwnames)) { + goto exit; + } _return_value = _opcode_stack_effect_impl(module, opcode, oparg); if ((_return_value == -1) && PyErr_Occurred()) { goto exit; @@ -35,4 +39,4 @@ _opcode_stack_effect(PyObject *module, PyObject *args) exit: return return_value; } -/*[clinic end generated code: output=4d91c6a765097853 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=62858005ac85baa9 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_operator.c.h b/Modules/clinic/_operator.c.h new file mode 100644 index 0000000000..318d233784 --- /dev/null +++ b/Modules/clinic/_operator.c.h @@ -0,0 +1,1648 @@ +/*[clinic input] +preserve +[clinic start generated code]*/ + +PyDoc_STRVAR(_operator_truth__doc__, +"truth($module, a, /)\n" +"--\n" +"\n" +"Return True if a is true, False otherwise."); + +#define _OPERATOR_TRUTH_METHODDEF \ + {"truth", (PyCFunction)_operator_truth, METH_O, _operator_truth__doc__}, + +static int +_operator_truth_impl(PyObject *module, PyObject *a); + +static PyObject * +_operator_truth(PyObject *module, PyObject *a) +{ + PyObject *return_value = NULL; + int _return_value; + + _return_value = _operator_truth_impl(module, a); + if ((_return_value == -1) && PyErr_Occurred()) { + goto exit; + } + return_value = PyBool_FromLong((long)_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_add__doc__, +"add($module, a, b, /)\n" +"--\n" +"\n" +"Same as a + b."); + +#define _OPERATOR_ADD_METHODDEF \ + {"add", (PyCFunction)_operator_add, METH_FASTCALL, _operator_add__doc__}, + +static PyObject * +_operator_add_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_add(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "add", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("add", kwnames)) { + goto exit; + } + return_value = _operator_add_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_sub__doc__, +"sub($module, a, b, /)\n" +"--\n" +"\n" +"Same as a - b."); + +#define _OPERATOR_SUB_METHODDEF \ + {"sub", (PyCFunction)_operator_sub, METH_FASTCALL, _operator_sub__doc__}, + +static PyObject * +_operator_sub_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_sub(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "sub", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("sub", kwnames)) { + goto exit; + } + return_value = _operator_sub_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_mul__doc__, +"mul($module, a, b, /)\n" +"--\n" +"\n" +"Same as a * b."); + +#define _OPERATOR_MUL_METHODDEF \ + {"mul", (PyCFunction)_operator_mul, METH_FASTCALL, _operator_mul__doc__}, + +static PyObject * +_operator_mul_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_mul(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "mul", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("mul", kwnames)) { + goto exit; + } + return_value = _operator_mul_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_matmul__doc__, +"matmul($module, a, b, /)\n" +"--\n" +"\n" +"Same as a @ b."); + +#define _OPERATOR_MATMUL_METHODDEF \ + {"matmul", (PyCFunction)_operator_matmul, METH_FASTCALL, _operator_matmul__doc__}, + +static PyObject * +_operator_matmul_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_matmul(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "matmul", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("matmul", kwnames)) { + goto exit; + } + return_value = _operator_matmul_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_floordiv__doc__, +"floordiv($module, a, b, /)\n" +"--\n" +"\n" +"Same as a // b."); + +#define _OPERATOR_FLOORDIV_METHODDEF \ + {"floordiv", (PyCFunction)_operator_floordiv, METH_FASTCALL, _operator_floordiv__doc__}, + +static PyObject * +_operator_floordiv_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_floordiv(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "floordiv", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("floordiv", kwnames)) { + goto exit; + } + return_value = _operator_floordiv_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_truediv__doc__, +"truediv($module, a, b, /)\n" +"--\n" +"\n" +"Same as a / b."); + +#define _OPERATOR_TRUEDIV_METHODDEF \ + {"truediv", (PyCFunction)_operator_truediv, METH_FASTCALL, _operator_truediv__doc__}, + +static PyObject * +_operator_truediv_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_truediv(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "truediv", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("truediv", kwnames)) { + goto exit; + } + return_value = _operator_truediv_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_mod__doc__, +"mod($module, a, b, /)\n" +"--\n" +"\n" +"Same as a % b."); + +#define _OPERATOR_MOD_METHODDEF \ + {"mod", (PyCFunction)_operator_mod, METH_FASTCALL, _operator_mod__doc__}, + +static PyObject * +_operator_mod_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_mod(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "mod", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("mod", kwnames)) { + goto exit; + } + return_value = _operator_mod_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_neg__doc__, +"neg($module, a, /)\n" +"--\n" +"\n" +"Same as -a."); + +#define _OPERATOR_NEG_METHODDEF \ + {"neg", (PyCFunction)_operator_neg, METH_O, _operator_neg__doc__}, + +PyDoc_STRVAR(_operator_pos__doc__, +"pos($module, a, /)\n" +"--\n" +"\n" +"Same as +a."); + +#define _OPERATOR_POS_METHODDEF \ + {"pos", (PyCFunction)_operator_pos, METH_O, _operator_pos__doc__}, + +PyDoc_STRVAR(_operator_abs__doc__, +"abs($module, a, /)\n" +"--\n" +"\n" +"Same as abs(a)."); + +#define _OPERATOR_ABS_METHODDEF \ + {"abs", (PyCFunction)_operator_abs, METH_O, _operator_abs__doc__}, + +PyDoc_STRVAR(_operator_inv__doc__, +"inv($module, a, /)\n" +"--\n" +"\n" +"Same as ~a."); + +#define _OPERATOR_INV_METHODDEF \ + {"inv", (PyCFunction)_operator_inv, METH_O, _operator_inv__doc__}, + +PyDoc_STRVAR(_operator_invert__doc__, +"invert($module, a, /)\n" +"--\n" +"\n" +"Same as ~a."); + +#define _OPERATOR_INVERT_METHODDEF \ + {"invert", (PyCFunction)_operator_invert, METH_O, _operator_invert__doc__}, + +PyDoc_STRVAR(_operator_lshift__doc__, +"lshift($module, a, b, /)\n" +"--\n" +"\n" +"Same as a << b."); + +#define _OPERATOR_LSHIFT_METHODDEF \ + {"lshift", (PyCFunction)_operator_lshift, METH_FASTCALL, _operator_lshift__doc__}, + +static PyObject * +_operator_lshift_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_lshift(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "lshift", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("lshift", kwnames)) { + goto exit; + } + return_value = _operator_lshift_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_rshift__doc__, +"rshift($module, a, b, /)\n" +"--\n" +"\n" +"Same as a >> b."); + +#define _OPERATOR_RSHIFT_METHODDEF \ + {"rshift", (PyCFunction)_operator_rshift, METH_FASTCALL, _operator_rshift__doc__}, + +static PyObject * +_operator_rshift_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_rshift(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "rshift", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("rshift", kwnames)) { + goto exit; + } + return_value = _operator_rshift_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_not___doc__, +"not_($module, a, /)\n" +"--\n" +"\n" +"Same as not a."); + +#define _OPERATOR_NOT__METHODDEF \ + {"not_", (PyCFunction)_operator_not_, METH_O, _operator_not___doc__}, + +static int +_operator_not__impl(PyObject *module, PyObject *a); + +static PyObject * +_operator_not_(PyObject *module, PyObject *a) +{ + PyObject *return_value = NULL; + int _return_value; + + _return_value = _operator_not__impl(module, a); + if ((_return_value == -1) && PyErr_Occurred()) { + goto exit; + } + return_value = PyBool_FromLong((long)_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_and___doc__, +"and_($module, a, b, /)\n" +"--\n" +"\n" +"Same as a & b."); + +#define _OPERATOR_AND__METHODDEF \ + {"and_", (PyCFunction)_operator_and_, METH_FASTCALL, _operator_and___doc__}, + +static PyObject * +_operator_and__impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_and_(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "and_", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("and_", kwnames)) { + goto exit; + } + return_value = _operator_and__impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_xor__doc__, +"xor($module, a, b, /)\n" +"--\n" +"\n" +"Same as a ^ b."); + +#define _OPERATOR_XOR_METHODDEF \ + {"xor", (PyCFunction)_operator_xor, METH_FASTCALL, _operator_xor__doc__}, + +static PyObject * +_operator_xor_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_xor(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "xor", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("xor", kwnames)) { + goto exit; + } + return_value = _operator_xor_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_or___doc__, +"or_($module, a, b, /)\n" +"--\n" +"\n" +"Same as a | b."); + +#define _OPERATOR_OR__METHODDEF \ + {"or_", (PyCFunction)_operator_or_, METH_FASTCALL, _operator_or___doc__}, + +static PyObject * +_operator_or__impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_or_(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "or_", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("or_", kwnames)) { + goto exit; + } + return_value = _operator_or__impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_iadd__doc__, +"iadd($module, a, b, /)\n" +"--\n" +"\n" +"Same as a += b."); + +#define _OPERATOR_IADD_METHODDEF \ + {"iadd", (PyCFunction)_operator_iadd, METH_FASTCALL, _operator_iadd__doc__}, + +static PyObject * +_operator_iadd_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_iadd(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "iadd", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("iadd", kwnames)) { + goto exit; + } + return_value = _operator_iadd_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_isub__doc__, +"isub($module, a, b, /)\n" +"--\n" +"\n" +"Same as a -= b."); + +#define _OPERATOR_ISUB_METHODDEF \ + {"isub", (PyCFunction)_operator_isub, METH_FASTCALL, _operator_isub__doc__}, + +static PyObject * +_operator_isub_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_isub(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "isub", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("isub", kwnames)) { + goto exit; + } + return_value = _operator_isub_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_imul__doc__, +"imul($module, a, b, /)\n" +"--\n" +"\n" +"Same as a *= b."); + +#define _OPERATOR_IMUL_METHODDEF \ + {"imul", (PyCFunction)_operator_imul, METH_FASTCALL, _operator_imul__doc__}, + +static PyObject * +_operator_imul_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_imul(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "imul", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("imul", kwnames)) { + goto exit; + } + return_value = _operator_imul_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_imatmul__doc__, +"imatmul($module, a, b, /)\n" +"--\n" +"\n" +"Same as a @= b."); + +#define _OPERATOR_IMATMUL_METHODDEF \ + {"imatmul", (PyCFunction)_operator_imatmul, METH_FASTCALL, _operator_imatmul__doc__}, + +static PyObject * +_operator_imatmul_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_imatmul(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "imatmul", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("imatmul", kwnames)) { + goto exit; + } + return_value = _operator_imatmul_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_ifloordiv__doc__, +"ifloordiv($module, a, b, /)\n" +"--\n" +"\n" +"Same as a //= b."); + +#define _OPERATOR_IFLOORDIV_METHODDEF \ + {"ifloordiv", (PyCFunction)_operator_ifloordiv, METH_FASTCALL, _operator_ifloordiv__doc__}, + +static PyObject * +_operator_ifloordiv_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_ifloordiv(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "ifloordiv", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("ifloordiv", kwnames)) { + goto exit; + } + return_value = _operator_ifloordiv_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_itruediv__doc__, +"itruediv($module, a, b, /)\n" +"--\n" +"\n" +"Same as a /= b."); + +#define _OPERATOR_ITRUEDIV_METHODDEF \ + {"itruediv", (PyCFunction)_operator_itruediv, METH_FASTCALL, _operator_itruediv__doc__}, + +static PyObject * +_operator_itruediv_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_itruediv(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "itruediv", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("itruediv", kwnames)) { + goto exit; + } + return_value = _operator_itruediv_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_imod__doc__, +"imod($module, a, b, /)\n" +"--\n" +"\n" +"Same as a %= b."); + +#define _OPERATOR_IMOD_METHODDEF \ + {"imod", (PyCFunction)_operator_imod, METH_FASTCALL, _operator_imod__doc__}, + +static PyObject * +_operator_imod_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_imod(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "imod", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("imod", kwnames)) { + goto exit; + } + return_value = _operator_imod_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_ilshift__doc__, +"ilshift($module, a, b, /)\n" +"--\n" +"\n" +"Same as a <<= b."); + +#define _OPERATOR_ILSHIFT_METHODDEF \ + {"ilshift", (PyCFunction)_operator_ilshift, METH_FASTCALL, _operator_ilshift__doc__}, + +static PyObject * +_operator_ilshift_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_ilshift(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "ilshift", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("ilshift", kwnames)) { + goto exit; + } + return_value = _operator_ilshift_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_irshift__doc__, +"irshift($module, a, b, /)\n" +"--\n" +"\n" +"Same as a >>= b."); + +#define _OPERATOR_IRSHIFT_METHODDEF \ + {"irshift", (PyCFunction)_operator_irshift, METH_FASTCALL, _operator_irshift__doc__}, + +static PyObject * +_operator_irshift_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_irshift(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "irshift", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("irshift", kwnames)) { + goto exit; + } + return_value = _operator_irshift_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_iand__doc__, +"iand($module, a, b, /)\n" +"--\n" +"\n" +"Same as a &= b."); + +#define _OPERATOR_IAND_METHODDEF \ + {"iand", (PyCFunction)_operator_iand, METH_FASTCALL, _operator_iand__doc__}, + +static PyObject * +_operator_iand_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_iand(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "iand", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("iand", kwnames)) { + goto exit; + } + return_value = _operator_iand_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_ixor__doc__, +"ixor($module, a, b, /)\n" +"--\n" +"\n" +"Same as a ^= b."); + +#define _OPERATOR_IXOR_METHODDEF \ + {"ixor", (PyCFunction)_operator_ixor, METH_FASTCALL, _operator_ixor__doc__}, + +static PyObject * +_operator_ixor_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_ixor(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "ixor", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("ixor", kwnames)) { + goto exit; + } + return_value = _operator_ixor_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_ior__doc__, +"ior($module, a, b, /)\n" +"--\n" +"\n" +"Same as a |= b."); + +#define _OPERATOR_IOR_METHODDEF \ + {"ior", (PyCFunction)_operator_ior, METH_FASTCALL, _operator_ior__doc__}, + +static PyObject * +_operator_ior_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_ior(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "ior", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("ior", kwnames)) { + goto exit; + } + return_value = _operator_ior_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_concat__doc__, +"concat($module, a, b, /)\n" +"--\n" +"\n" +"Same as a + b, for a and b sequences."); + +#define _OPERATOR_CONCAT_METHODDEF \ + {"concat", (PyCFunction)_operator_concat, METH_FASTCALL, _operator_concat__doc__}, + +static PyObject * +_operator_concat_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_concat(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "concat", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("concat", kwnames)) { + goto exit; + } + return_value = _operator_concat_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_iconcat__doc__, +"iconcat($module, a, b, /)\n" +"--\n" +"\n" +"Same as a += b, for a and b sequences."); + +#define _OPERATOR_ICONCAT_METHODDEF \ + {"iconcat", (PyCFunction)_operator_iconcat, METH_FASTCALL, _operator_iconcat__doc__}, + +static PyObject * +_operator_iconcat_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_iconcat(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "iconcat", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("iconcat", kwnames)) { + goto exit; + } + return_value = _operator_iconcat_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_contains__doc__, +"contains($module, a, b, /)\n" +"--\n" +"\n" +"Same as b in a (note reversed operands)."); + +#define _OPERATOR_CONTAINS_METHODDEF \ + {"contains", (PyCFunction)_operator_contains, METH_FASTCALL, _operator_contains__doc__}, + +static int +_operator_contains_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_contains(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + int _return_value; + + if (!_PyArg_UnpackStack(args, nargs, "contains", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("contains", kwnames)) { + goto exit; + } + _return_value = _operator_contains_impl(module, a, b); + if ((_return_value == -1) && PyErr_Occurred()) { + goto exit; + } + return_value = PyBool_FromLong((long)_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_indexOf__doc__, +"indexOf($module, a, b, /)\n" +"--\n" +"\n" +"Return the first index of b in a."); + +#define _OPERATOR_INDEXOF_METHODDEF \ + {"indexOf", (PyCFunction)_operator_indexOf, METH_FASTCALL, _operator_indexOf__doc__}, + +static Py_ssize_t +_operator_indexOf_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_indexOf(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + Py_ssize_t _return_value; + + if (!_PyArg_UnpackStack(args, nargs, "indexOf", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("indexOf", kwnames)) { + goto exit; + } + _return_value = _operator_indexOf_impl(module, a, b); + if ((_return_value == -1) && PyErr_Occurred()) { + goto exit; + } + return_value = PyLong_FromSsize_t(_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_countOf__doc__, +"countOf($module, a, b, /)\n" +"--\n" +"\n" +"Return the number of times b occurs in a."); + +#define _OPERATOR_COUNTOF_METHODDEF \ + {"countOf", (PyCFunction)_operator_countOf, METH_FASTCALL, _operator_countOf__doc__}, + +static Py_ssize_t +_operator_countOf_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_countOf(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + Py_ssize_t _return_value; + + if (!_PyArg_UnpackStack(args, nargs, "countOf", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("countOf", kwnames)) { + goto exit; + } + _return_value = _operator_countOf_impl(module, a, b); + if ((_return_value == -1) && PyErr_Occurred()) { + goto exit; + } + return_value = PyLong_FromSsize_t(_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_getitem__doc__, +"getitem($module, a, b, /)\n" +"--\n" +"\n" +"Same as a[b]."); + +#define _OPERATOR_GETITEM_METHODDEF \ + {"getitem", (PyCFunction)_operator_getitem, METH_FASTCALL, _operator_getitem__doc__}, + +static PyObject * +_operator_getitem_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_getitem(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "getitem", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("getitem", kwnames)) { + goto exit; + } + return_value = _operator_getitem_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_setitem__doc__, +"setitem($module, a, b, c, /)\n" +"--\n" +"\n" +"Same as a[b] = c."); + +#define _OPERATOR_SETITEM_METHODDEF \ + {"setitem", (PyCFunction)_operator_setitem, METH_FASTCALL, _operator_setitem__doc__}, + +static PyObject * +_operator_setitem_impl(PyObject *module, PyObject *a, PyObject *b, + PyObject *c); + +static PyObject * +_operator_setitem(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + PyObject *c; + + if (!_PyArg_UnpackStack(args, nargs, "setitem", + 3, 3, + &a, &b, &c)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("setitem", kwnames)) { + goto exit; + } + return_value = _operator_setitem_impl(module, a, b, c); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_delitem__doc__, +"delitem($module, a, b, /)\n" +"--\n" +"\n" +"Same as del a[b]."); + +#define _OPERATOR_DELITEM_METHODDEF \ + {"delitem", (PyCFunction)_operator_delitem, METH_FASTCALL, _operator_delitem__doc__}, + +static PyObject * +_operator_delitem_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_delitem(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "delitem", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("delitem", kwnames)) { + goto exit; + } + return_value = _operator_delitem_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_eq__doc__, +"eq($module, a, b, /)\n" +"--\n" +"\n" +"Same as a == b."); + +#define _OPERATOR_EQ_METHODDEF \ + {"eq", (PyCFunction)_operator_eq, METH_FASTCALL, _operator_eq__doc__}, + +static PyObject * +_operator_eq_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_eq(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "eq", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("eq", kwnames)) { + goto exit; + } + return_value = _operator_eq_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_ne__doc__, +"ne($module, a, b, /)\n" +"--\n" +"\n" +"Same as a != b."); + +#define _OPERATOR_NE_METHODDEF \ + {"ne", (PyCFunction)_operator_ne, METH_FASTCALL, _operator_ne__doc__}, + +static PyObject * +_operator_ne_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_ne(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "ne", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("ne", kwnames)) { + goto exit; + } + return_value = _operator_ne_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_lt__doc__, +"lt($module, a, b, /)\n" +"--\n" +"\n" +"Same as a < b."); + +#define _OPERATOR_LT_METHODDEF \ + {"lt", (PyCFunction)_operator_lt, METH_FASTCALL, _operator_lt__doc__}, + +static PyObject * +_operator_lt_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_lt(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "lt", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("lt", kwnames)) { + goto exit; + } + return_value = _operator_lt_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_le__doc__, +"le($module, a, b, /)\n" +"--\n" +"\n" +"Same as a <= b."); + +#define _OPERATOR_LE_METHODDEF \ + {"le", (PyCFunction)_operator_le, METH_FASTCALL, _operator_le__doc__}, + +static PyObject * +_operator_le_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_le(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "le", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("le", kwnames)) { + goto exit; + } + return_value = _operator_le_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_gt__doc__, +"gt($module, a, b, /)\n" +"--\n" +"\n" +"Same as a > b."); + +#define _OPERATOR_GT_METHODDEF \ + {"gt", (PyCFunction)_operator_gt, METH_FASTCALL, _operator_gt__doc__}, + +static PyObject * +_operator_gt_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_gt(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "gt", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("gt", kwnames)) { + goto exit; + } + return_value = _operator_gt_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_ge__doc__, +"ge($module, a, b, /)\n" +"--\n" +"\n" +"Same as a >= b."); + +#define _OPERATOR_GE_METHODDEF \ + {"ge", (PyCFunction)_operator_ge, METH_FASTCALL, _operator_ge__doc__}, + +static PyObject * +_operator_ge_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_ge(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "ge", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("ge", kwnames)) { + goto exit; + } + return_value = _operator_ge_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_pow__doc__, +"pow($module, a, b, /)\n" +"--\n" +"\n" +"Same as a ** b."); + +#define _OPERATOR_POW_METHODDEF \ + {"pow", (PyCFunction)_operator_pow, METH_FASTCALL, _operator_pow__doc__}, + +static PyObject * +_operator_pow_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_pow(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "pow", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("pow", kwnames)) { + goto exit; + } + return_value = _operator_pow_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_ipow__doc__, +"ipow($module, a, b, /)\n" +"--\n" +"\n" +"Same as a **= b."); + +#define _OPERATOR_IPOW_METHODDEF \ + {"ipow", (PyCFunction)_operator_ipow, METH_FASTCALL, _operator_ipow__doc__}, + +static PyObject * +_operator_ipow_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_ipow(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "ipow", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("ipow", kwnames)) { + goto exit; + } + return_value = _operator_ipow_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_index__doc__, +"index($module, a, /)\n" +"--\n" +"\n" +"Same as a.__index__()"); + +#define _OPERATOR_INDEX_METHODDEF \ + {"index", (PyCFunction)_operator_index, METH_O, _operator_index__doc__}, + +PyDoc_STRVAR(_operator_is___doc__, +"is_($module, a, b, /)\n" +"--\n" +"\n" +"Same as a is b."); + +#define _OPERATOR_IS__METHODDEF \ + {"is_", (PyCFunction)_operator_is_, METH_FASTCALL, _operator_is___doc__}, + +static PyObject * +_operator_is__impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_is_(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "is_", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("is_", kwnames)) { + goto exit; + } + return_value = _operator_is__impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_is_not__doc__, +"is_not($module, a, b, /)\n" +"--\n" +"\n" +"Same as a is not b."); + +#define _OPERATOR_IS_NOT_METHODDEF \ + {"is_not", (PyCFunction)_operator_is_not, METH_FASTCALL, _operator_is_not__doc__}, + +static PyObject * +_operator_is_not_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator_is_not(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "is_not", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("is_not", kwnames)) { + goto exit; + } + return_value = _operator_is_not_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator_length_hint__doc__, +"length_hint($module, obj, default=0, /)\n" +"--\n" +"\n" +"Return an estimate of the number of items in obj.\n" +"\n" +"This is useful for presizing containers when building from an iterable.\n" +"\n" +"If the object supports len(), the result will be exact.\n" +"Otherwise, it may over- or under-estimate by an arbitrary amount.\n" +"The result will be an integer >= 0."); + +#define _OPERATOR_LENGTH_HINT_METHODDEF \ + {"length_hint", (PyCFunction)_operator_length_hint, METH_FASTCALL, _operator_length_hint__doc__}, + +static Py_ssize_t +_operator_length_hint_impl(PyObject *module, PyObject *obj, + Py_ssize_t default_value); + +static PyObject * +_operator_length_hint(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *obj; + Py_ssize_t default_value = 0; + Py_ssize_t _return_value; + + if (!_PyArg_ParseStack(args, nargs, "O|n:length_hint", + &obj, &default_value)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("length_hint", kwnames)) { + goto exit; + } + _return_value = _operator_length_hint_impl(module, obj, default_value); + if ((_return_value == -1) && PyErr_Occurred()) { + goto exit; + } + return_value = PyLong_FromSsize_t(_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(_operator__compare_digest__doc__, +"_compare_digest($module, a, b, /)\n" +"--\n" +"\n" +"Return \'a == b\'.\n" +"\n" +"This function uses an approach designed to prevent\n" +"timing analysis, making it appropriate for cryptography.\n" +"\n" +"a and b must both be of the same type: either str (ASCII only),\n" +"or any bytes-like object.\n" +"\n" +"Note: If a and b are of different lengths, or if an error occurs,\n" +"a timing attack could theoretically reveal information about the\n" +"types and lengths of a and b--but not their values."); + +#define _OPERATOR__COMPARE_DIGEST_METHODDEF \ + {"_compare_digest", (PyCFunction)_operator__compare_digest, METH_FASTCALL, _operator__compare_digest__doc__}, + +static PyObject * +_operator__compare_digest_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +_operator__compare_digest(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "_compare_digest", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("_compare_digest", kwnames)) { + goto exit; + } + return_value = _operator__compare_digest_impl(module, a, b); + +exit: + return return_value; +} +/*[clinic end generated code: output=c030b6747fddd9c6 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_pickle.c.h b/Modules/clinic/_pickle.c.h index 9ad4c37f47..e10730a6de 100644 --- a/Modules/clinic/_pickle.c.h +++ b/Modules/clinic/_pickle.c.h @@ -199,7 +199,7 @@ PyDoc_STRVAR(_pickle_Unpickler_find_class__doc__, "needed. Both arguments passed are str objects."); #define _PICKLE_UNPICKLER_FIND_CLASS_METHODDEF \ - {"find_class", (PyCFunction)_pickle_Unpickler_find_class, METH_VARARGS, _pickle_Unpickler_find_class__doc__}, + {"find_class", (PyCFunction)_pickle_Unpickler_find_class, METH_FASTCALL, _pickle_Unpickler_find_class__doc__}, static PyObject * _pickle_Unpickler_find_class_impl(UnpicklerObject *self, @@ -207,17 +207,21 @@ _pickle_Unpickler_find_class_impl(UnpicklerObject *self, PyObject *global_name); static PyObject * -_pickle_Unpickler_find_class(UnpicklerObject *self, PyObject *args) +_pickle_Unpickler_find_class(UnpicklerObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *module_name; PyObject *global_name; - if (!PyArg_UnpackTuple(args, "find_class", + if (!_PyArg_UnpackStack(args, nargs, "find_class", 2, 2, &module_name, &global_name)) { goto exit; } + + if (!_PyArg_NoStackKeywords("find_class", kwnames)) { + goto exit; + } return_value = _pickle_Unpickler_find_class_impl(self, module_name, global_name); exit: @@ -401,7 +405,7 @@ _pickle_dump(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwna PyObject *protocol = NULL; int fix_imports = 1; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &obj, &file, &protocol, &fix_imports)) { goto exit; } @@ -446,7 +450,7 @@ _pickle_dumps(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwn PyObject *protocol = NULL; int fix_imports = 1; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &obj, &protocol, &fix_imports)) { goto exit; } @@ -503,7 +507,7 @@ _pickle_load(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwna const char *encoding = "ASCII"; const char *errors = "strict"; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &file, &fix_imports, &encoding, &errors)) { goto exit; } @@ -551,7 +555,7 @@ _pickle_loads(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwn const char *encoding = "ASCII"; const char *errors = "strict"; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &data, &fix_imports, &encoding, &errors)) { goto exit; } @@ -560,4 +564,4 @@ _pickle_loads(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwn exit: return return_value; } -/*[clinic end generated code: output=82be137b3c09cb9f input=a9049054013a1b77]*/ +/*[clinic end generated code: output=b921d325b2f7a096 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_sre.c.h b/Modules/clinic/_sre.c.h index 0612005d1e..fcb23e8919 100644 --- a/Modules/clinic/_sre.c.h +++ b/Modules/clinic/_sre.c.h @@ -35,23 +35,27 @@ PyDoc_STRVAR(_sre_getlower__doc__, "\n"); #define _SRE_GETLOWER_METHODDEF \ - {"getlower", (PyCFunction)_sre_getlower, METH_VARARGS, _sre_getlower__doc__}, + {"getlower", (PyCFunction)_sre_getlower, METH_FASTCALL, _sre_getlower__doc__}, static int _sre_getlower_impl(PyObject *module, int character, int flags); static PyObject * -_sre_getlower(PyObject *module, PyObject *args) +_sre_getlower(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int character; int flags; int _return_value; - if (!PyArg_ParseTuple(args, "ii:getlower", + if (!_PyArg_ParseStack(args, nargs, "ii:getlower", &character, &flags)) { goto exit; } + + if (!_PyArg_NoStackKeywords("getlower", kwnames)) { + goto exit; + } _return_value = _sre_getlower_impl(module, character, flags); if ((_return_value == -1) && PyErr_Occurred()) { goto exit; @@ -63,7 +67,7 @@ exit: } PyDoc_STRVAR(_sre_SRE_Pattern_match__doc__, -"match($self, /, string=None, pos=0, endpos=sys.maxsize, *, pattern=None)\n" +"match($self, /, string, pos=0, endpos=sys.maxsize)\n" "--\n" "\n" "Matches zero or more characters at the beginning of the string."); @@ -73,33 +77,30 @@ PyDoc_STRVAR(_sre_SRE_Pattern_match__doc__, static PyObject * _sre_SRE_Pattern_match_impl(PatternObject *self, PyObject *string, - Py_ssize_t pos, Py_ssize_t endpos, - PyObject *pattern); + Py_ssize_t pos, Py_ssize_t endpos); static PyObject * _sre_SRE_Pattern_match(PatternObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; - static const char * const _keywords[] = {"string", "pos", "endpos", "pattern", NULL}; - static _PyArg_Parser _parser = {"|Onn$O:match", _keywords, 0}; - PyObject *string = NULL; + static const char * const _keywords[] = {"string", "pos", "endpos", NULL}; + static _PyArg_Parser _parser = {"O|nn:match", _keywords, 0}; + PyObject *string; Py_ssize_t pos = 0; Py_ssize_t endpos = PY_SSIZE_T_MAX; - PyObject *pattern = NULL; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, - &string, &pos, &endpos, &pattern)) { + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &string, &pos, &endpos)) { goto exit; } - return_value = _sre_SRE_Pattern_match_impl(self, string, pos, endpos, pattern); + return_value = _sre_SRE_Pattern_match_impl(self, string, pos, endpos); exit: return return_value; } PyDoc_STRVAR(_sre_SRE_Pattern_fullmatch__doc__, -"fullmatch($self, /, string=None, pos=0, endpos=sys.maxsize, *,\n" -" pattern=None)\n" +"fullmatch($self, /, string, pos=0, endpos=sys.maxsize)\n" "--\n" "\n" "Matches against all of the string"); @@ -109,33 +110,30 @@ PyDoc_STRVAR(_sre_SRE_Pattern_fullmatch__doc__, static PyObject * _sre_SRE_Pattern_fullmatch_impl(PatternObject *self, PyObject *string, - Py_ssize_t pos, Py_ssize_t endpos, - PyObject *pattern); + Py_ssize_t pos, Py_ssize_t endpos); static PyObject * _sre_SRE_Pattern_fullmatch(PatternObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; - static const char * const _keywords[] = {"string", "pos", "endpos", "pattern", NULL}; - static _PyArg_Parser _parser = {"|Onn$O:fullmatch", _keywords, 0}; - PyObject *string = NULL; + static const char * const _keywords[] = {"string", "pos", "endpos", NULL}; + static _PyArg_Parser _parser = {"O|nn:fullmatch", _keywords, 0}; + PyObject *string; Py_ssize_t pos = 0; Py_ssize_t endpos = PY_SSIZE_T_MAX; - PyObject *pattern = NULL; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, - &string, &pos, &endpos, &pattern)) { + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &string, &pos, &endpos)) { goto exit; } - return_value = _sre_SRE_Pattern_fullmatch_impl(self, string, pos, endpos, pattern); + return_value = _sre_SRE_Pattern_fullmatch_impl(self, string, pos, endpos); exit: return return_value; } PyDoc_STRVAR(_sre_SRE_Pattern_search__doc__, -"search($self, /, string=None, pos=0, endpos=sys.maxsize, *,\n" -" pattern=None)\n" +"search($self, /, string, pos=0, endpos=sys.maxsize)\n" "--\n" "\n" "Scan through string looking for a match, and return a corresponding match object instance.\n" @@ -147,33 +145,30 @@ PyDoc_STRVAR(_sre_SRE_Pattern_search__doc__, static PyObject * _sre_SRE_Pattern_search_impl(PatternObject *self, PyObject *string, - Py_ssize_t pos, Py_ssize_t endpos, - PyObject *pattern); + Py_ssize_t pos, Py_ssize_t endpos); static PyObject * _sre_SRE_Pattern_search(PatternObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; - static const char * const _keywords[] = {"string", "pos", "endpos", "pattern", NULL}; - static _PyArg_Parser _parser = {"|Onn$O:search", _keywords, 0}; - PyObject *string = NULL; + static const char * const _keywords[] = {"string", "pos", "endpos", NULL}; + static _PyArg_Parser _parser = {"O|nn:search", _keywords, 0}; + PyObject *string; Py_ssize_t pos = 0; Py_ssize_t endpos = PY_SSIZE_T_MAX; - PyObject *pattern = NULL; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, - &string, &pos, &endpos, &pattern)) { + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &string, &pos, &endpos)) { goto exit; } - return_value = _sre_SRE_Pattern_search_impl(self, string, pos, endpos, pattern); + return_value = _sre_SRE_Pattern_search_impl(self, string, pos, endpos); exit: return return_value; } PyDoc_STRVAR(_sre_SRE_Pattern_findall__doc__, -"findall($self, /, string=None, pos=0, endpos=sys.maxsize, *,\n" -" source=None)\n" +"findall($self, /, string, pos=0, endpos=sys.maxsize)\n" "--\n" "\n" "Return a list of all non-overlapping matches of pattern in string."); @@ -183,25 +178,23 @@ PyDoc_STRVAR(_sre_SRE_Pattern_findall__doc__, static PyObject * _sre_SRE_Pattern_findall_impl(PatternObject *self, PyObject *string, - Py_ssize_t pos, Py_ssize_t endpos, - PyObject *source); + Py_ssize_t pos, Py_ssize_t endpos); static PyObject * _sre_SRE_Pattern_findall(PatternObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; - static const char * const _keywords[] = {"string", "pos", "endpos", "source", NULL}; - static _PyArg_Parser _parser = {"|Onn$O:findall", _keywords, 0}; - PyObject *string = NULL; + static const char * const _keywords[] = {"string", "pos", "endpos", NULL}; + static _PyArg_Parser _parser = {"O|nn:findall", _keywords, 0}; + PyObject *string; Py_ssize_t pos = 0; Py_ssize_t endpos = PY_SSIZE_T_MAX; - PyObject *source = NULL; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, - &string, &pos, &endpos, &source)) { + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &string, &pos, &endpos)) { goto exit; } - return_value = _sre_SRE_Pattern_findall_impl(self, string, pos, endpos, source); + return_value = _sre_SRE_Pattern_findall_impl(self, string, pos, endpos); exit: return return_value; @@ -232,7 +225,7 @@ _sre_SRE_Pattern_finditer(PatternObject *self, PyObject **args, Py_ssize_t nargs Py_ssize_t pos = 0; Py_ssize_t endpos = PY_SSIZE_T_MAX; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &string, &pos, &endpos)) { goto exit; } @@ -264,7 +257,7 @@ _sre_SRE_Pattern_scanner(PatternObject *self, PyObject **args, Py_ssize_t nargs, Py_ssize_t pos = 0; Py_ssize_t endpos = PY_SSIZE_T_MAX; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &string, &pos, &endpos)) { goto exit; } @@ -275,7 +268,7 @@ exit: } PyDoc_STRVAR(_sre_SRE_Pattern_split__doc__, -"split($self, /, string=None, maxsplit=0, *, source=None)\n" +"split($self, /, string, maxsplit=0)\n" "--\n" "\n" "Split string by the occurrences of pattern."); @@ -285,23 +278,22 @@ PyDoc_STRVAR(_sre_SRE_Pattern_split__doc__, static PyObject * _sre_SRE_Pattern_split_impl(PatternObject *self, PyObject *string, - Py_ssize_t maxsplit, PyObject *source); + Py_ssize_t maxsplit); static PyObject * _sre_SRE_Pattern_split(PatternObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; - static const char * const _keywords[] = {"string", "maxsplit", "source", NULL}; - static _PyArg_Parser _parser = {"|On$O:split", _keywords, 0}; - PyObject *string = NULL; + static const char * const _keywords[] = {"string", "maxsplit", NULL}; + static _PyArg_Parser _parser = {"O|n:split", _keywords, 0}; + PyObject *string; Py_ssize_t maxsplit = 0; - PyObject *source = NULL; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, - &string, &maxsplit, &source)) { + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &string, &maxsplit)) { goto exit; } - return_value = _sre_SRE_Pattern_split_impl(self, string, maxsplit, source); + return_value = _sre_SRE_Pattern_split_impl(self, string, maxsplit); exit: return return_value; @@ -330,7 +322,7 @@ _sre_SRE_Pattern_sub(PatternObject *self, PyObject **args, Py_ssize_t nargs, PyO PyObject *string; Py_ssize_t count = 0; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &repl, &string, &count)) { goto exit; } @@ -363,7 +355,7 @@ _sre_SRE_Pattern_subn(PatternObject *self, PyObject **args, Py_ssize_t nargs, Py PyObject *string; Py_ssize_t count = 0; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &repl, &string, &count)) { goto exit; } @@ -409,7 +401,7 @@ _sre_SRE_Pattern___deepcopy__(PatternObject *self, PyObject **args, Py_ssize_t n static _PyArg_Parser _parser = {"O:__deepcopy__", _keywords, 0}; PyObject *memo; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &memo)) { goto exit; } @@ -438,7 +430,7 @@ _sre_compile(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwna { PyObject *return_value = NULL; static const char * const _keywords[] = {"pattern", "flags", "code", "groups", "groupindex", "indexgroup", NULL}; - static _PyArg_Parser _parser = {"OiO!nOO:compile", _keywords, 0}; + static _PyArg_Parser _parser = {"OiO!nO!O!:compile", _keywords, 0}; PyObject *pattern; int flags; PyObject *code; @@ -446,8 +438,8 @@ _sre_compile(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwna PyObject *groupindex; PyObject *indexgroup; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, - &pattern, &flags, &PyList_Type, &code, &groups, &groupindex, &indexgroup)) { + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &pattern, &flags, &PyList_Type, &code, &groups, &PyDict_Type, &groupindex, &PyTuple_Type, &indexgroup)) { goto exit; } return_value = _sre_compile_impl(module, pattern, flags, code, groups, groupindex, indexgroup); @@ -476,7 +468,7 @@ _sre_SRE_Match_expand(MatchObject *self, PyObject **args, Py_ssize_t nargs, PyOb static _PyArg_Parser _parser = {"O:expand", _keywords, 0}; PyObject *template; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &template)) { goto exit; } @@ -509,7 +501,7 @@ _sre_SRE_Match_groups(MatchObject *self, PyObject **args, Py_ssize_t nargs, PyOb static _PyArg_Parser _parser = {"|O:groups", _keywords, 0}; PyObject *default_value = Py_None; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &default_value)) { goto exit; } @@ -542,7 +534,7 @@ _sre_SRE_Match_groupdict(MatchObject *self, PyObject **args, Py_ssize_t nargs, P static _PyArg_Parser _parser = {"|O:groupdict", _keywords, 0}; PyObject *default_value = Py_None; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &default_value)) { goto exit; } @@ -559,23 +551,27 @@ PyDoc_STRVAR(_sre_SRE_Match_start__doc__, "Return index of the start of the substring matched by group."); #define _SRE_SRE_MATCH_START_METHODDEF \ - {"start", (PyCFunction)_sre_SRE_Match_start, METH_VARARGS, _sre_SRE_Match_start__doc__}, + {"start", (PyCFunction)_sre_SRE_Match_start, METH_FASTCALL, _sre_SRE_Match_start__doc__}, static Py_ssize_t _sre_SRE_Match_start_impl(MatchObject *self, PyObject *group); static PyObject * -_sre_SRE_Match_start(MatchObject *self, PyObject *args) +_sre_SRE_Match_start(MatchObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *group = NULL; Py_ssize_t _return_value; - if (!PyArg_UnpackTuple(args, "start", + if (!_PyArg_UnpackStack(args, nargs, "start", 0, 1, &group)) { goto exit; } + + if (!_PyArg_NoStackKeywords("start", kwnames)) { + goto exit; + } _return_value = _sre_SRE_Match_start_impl(self, group); if ((_return_value == -1) && PyErr_Occurred()) { goto exit; @@ -593,23 +589,27 @@ PyDoc_STRVAR(_sre_SRE_Match_end__doc__, "Return index of the end of the substring matched by group."); #define _SRE_SRE_MATCH_END_METHODDEF \ - {"end", (PyCFunction)_sre_SRE_Match_end, METH_VARARGS, _sre_SRE_Match_end__doc__}, + {"end", (PyCFunction)_sre_SRE_Match_end, METH_FASTCALL, _sre_SRE_Match_end__doc__}, static Py_ssize_t _sre_SRE_Match_end_impl(MatchObject *self, PyObject *group); static PyObject * -_sre_SRE_Match_end(MatchObject *self, PyObject *args) +_sre_SRE_Match_end(MatchObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *group = NULL; Py_ssize_t _return_value; - if (!PyArg_UnpackTuple(args, "end", + if (!_PyArg_UnpackStack(args, nargs, "end", 0, 1, &group)) { goto exit; } + + if (!_PyArg_NoStackKeywords("end", kwnames)) { + goto exit; + } _return_value = _sre_SRE_Match_end_impl(self, group); if ((_return_value == -1) && PyErr_Occurred()) { goto exit; @@ -627,22 +627,26 @@ PyDoc_STRVAR(_sre_SRE_Match_span__doc__, "For MatchObject m, return the 2-tuple (m.start(group), m.end(group))."); #define _SRE_SRE_MATCH_SPAN_METHODDEF \ - {"span", (PyCFunction)_sre_SRE_Match_span, METH_VARARGS, _sre_SRE_Match_span__doc__}, + {"span", (PyCFunction)_sre_SRE_Match_span, METH_FASTCALL, _sre_SRE_Match_span__doc__}, static PyObject * _sre_SRE_Match_span_impl(MatchObject *self, PyObject *group); static PyObject * -_sre_SRE_Match_span(MatchObject *self, PyObject *args) +_sre_SRE_Match_span(MatchObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *group = NULL; - if (!PyArg_UnpackTuple(args, "span", + if (!_PyArg_UnpackStack(args, nargs, "span", 0, 1, &group)) { goto exit; } + + if (!_PyArg_NoStackKeywords("span", kwnames)) { + goto exit; + } return_value = _sre_SRE_Match_span_impl(self, group); exit: @@ -685,7 +689,7 @@ _sre_SRE_Match___deepcopy__(MatchObject *self, PyObject **args, Py_ssize_t nargs static _PyArg_Parser _parser = {"O:__deepcopy__", _keywords, 0}; PyObject *memo; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &memo)) { goto exit; } @@ -728,4 +732,4 @@ _sre_SRE_Scanner_search(ScannerObject *self, PyObject *Py_UNUSED(ignored)) { return _sre_SRE_Scanner_search_impl(self); } -/*[clinic end generated code: output=a4a246bca1963bc9 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=5df18da8e2dc762c input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_ssl.c.h b/Modules/clinic/_ssl.c.h index 29f5838439..905274fec9 100644 --- a/Modules/clinic/_ssl.c.h +++ b/Modules/clinic/_ssl.c.h @@ -60,21 +60,25 @@ PyDoc_STRVAR(_ssl__SSLSocket_peer_certificate__doc__, "return the certificate even if it wasn\'t validated."); #define _SSL__SSLSOCKET_PEER_CERTIFICATE_METHODDEF \ - {"peer_certificate", (PyCFunction)_ssl__SSLSocket_peer_certificate, METH_VARARGS, _ssl__SSLSocket_peer_certificate__doc__}, + {"peer_certificate", (PyCFunction)_ssl__SSLSocket_peer_certificate, METH_FASTCALL, _ssl__SSLSocket_peer_certificate__doc__}, static PyObject * _ssl__SSLSocket_peer_certificate_impl(PySSLSocket *self, int binary_mode); static PyObject * -_ssl__SSLSocket_peer_certificate(PySSLSocket *self, PyObject *args) +_ssl__SSLSocket_peer_certificate(PySSLSocket *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int binary_mode = 0; - if (!PyArg_ParseTuple(args, "|p:peer_certificate", + if (!_PyArg_ParseStack(args, nargs, "|p:peer_certificate", &binary_mode)) { goto exit; } + + if (!_PyArg_NoStackKeywords("peer_certificate", kwnames)) { + goto exit; + } return_value = _ssl__SSLSocket_peer_certificate_impl(self, binary_mode); exit: @@ -485,7 +489,7 @@ _ssl__SSLContext_load_cert_chain(PySSLContext *self, PyObject **args, Py_ssize_t PyObject *keyfile = NULL; PyObject *password = NULL; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &certfile, &keyfile, &password)) { goto exit; } @@ -519,7 +523,7 @@ _ssl__SSLContext_load_verify_locations(PySSLContext *self, PyObject **args, Py_s PyObject *capath = NULL; PyObject *cadata = NULL; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &cafile, &capath, &cadata)) { goto exit; } @@ -559,7 +563,7 @@ _ssl__SSLContext__wrap_socket(PySSLContext *self, PyObject **args, Py_ssize_t na int server_side; PyObject *hostname_obj = Py_None; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, PySocketModule.Sock_Type, &sock, &server_side, &hostname_obj)) { goto exit; } @@ -594,7 +598,7 @@ _ssl__SSLContext__wrap_bio(PySSLContext *self, PyObject **args, Py_ssize_t nargs int server_side; PyObject *hostname_obj = Py_None; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &PySSLMemoryBIO_Type, &incoming, &PySSLMemoryBIO_Type, &outgoing, &server_side, &hostname_obj)) { goto exit; } @@ -713,7 +717,7 @@ _ssl__SSLContext_get_ca_certs(PySSLContext *self, PyObject **args, Py_ssize_t na static _PyArg_Parser _parser = {"|p:get_ca_certs", _keywords, 0}; int binary_form = 0; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &binary_form)) { goto exit; } @@ -757,21 +761,25 @@ PyDoc_STRVAR(_ssl_MemoryBIO_read__doc__, "distinguish between the two."); #define _SSL_MEMORYBIO_READ_METHODDEF \ - {"read", (PyCFunction)_ssl_MemoryBIO_read, METH_VARARGS, _ssl_MemoryBIO_read__doc__}, + {"read", (PyCFunction)_ssl_MemoryBIO_read, METH_FASTCALL, _ssl_MemoryBIO_read__doc__}, static PyObject * _ssl_MemoryBIO_read_impl(PySSLMemoryBIO *self, int len); static PyObject * -_ssl_MemoryBIO_read(PySSLMemoryBIO *self, PyObject *args) +_ssl_MemoryBIO_read(PySSLMemoryBIO *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int len = -1; - if (!PyArg_ParseTuple(args, "|i:read", + if (!_PyArg_ParseStack(args, nargs, "|i:read", &len)) { goto exit; } + + if (!_PyArg_NoStackKeywords("read", kwnames)) { + goto exit; + } return_value = _ssl_MemoryBIO_read_impl(self, len); exit: @@ -842,22 +850,26 @@ PyDoc_STRVAR(_ssl_RAND_add__doc__, "string. See RFC 1750."); #define _SSL_RAND_ADD_METHODDEF \ - {"RAND_add", (PyCFunction)_ssl_RAND_add, METH_VARARGS, _ssl_RAND_add__doc__}, + {"RAND_add", (PyCFunction)_ssl_RAND_add, METH_FASTCALL, _ssl_RAND_add__doc__}, static PyObject * _ssl_RAND_add_impl(PyObject *module, Py_buffer *view, double entropy); static PyObject * -_ssl_RAND_add(PyObject *module, PyObject *args) +_ssl_RAND_add(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer view = {NULL, NULL}; double entropy; - if (!PyArg_ParseTuple(args, "s*d:RAND_add", + if (!_PyArg_ParseStack(args, nargs, "s*d:RAND_add", &view, &entropy)) { goto exit; } + + if (!_PyArg_NoStackKeywords("RAND_add", kwnames)) { + goto exit; + } return_value = _ssl_RAND_add_impl(module, &view, entropy); exit: @@ -1025,7 +1037,7 @@ _ssl_txt2obj(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwna const char *txt; int name = 0; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &txt, &name)) { goto exit; } @@ -1090,7 +1102,7 @@ _ssl_enum_certificates(PyObject *module, PyObject **args, Py_ssize_t nargs, PyOb static _PyArg_Parser _parser = {"s:enum_certificates", _keywords, 0}; const char *store_name; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &store_name)) { goto exit; } @@ -1129,7 +1141,7 @@ _ssl_enum_crls(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kw static _PyArg_Parser _parser = {"s:enum_crls", _keywords, 0}; const char *store_name; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &store_name)) { goto exit; } @@ -1168,4 +1180,4 @@ exit: #ifndef _SSL_ENUM_CRLS_METHODDEF #define _SSL_ENUM_CRLS_METHODDEF #endif /* !defined(_SSL_ENUM_CRLS_METHODDEF) */ -/*[clinic end generated code: output=a859b21fe68a6115 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=53cd9100580b45a2 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_struct.c.h b/Modules/clinic/_struct.c.h new file mode 100644 index 0000000000..f9c3a5ce66 --- /dev/null +++ b/Modules/clinic/_struct.c.h @@ -0,0 +1,280 @@ +/*[clinic input] +preserve +[clinic start generated code]*/ + +PyDoc_STRVAR(Struct___init____doc__, +"Struct(format)\n" +"--\n" +"\n" +"Create a compiled struct object.\n" +"\n" +"Return a new Struct object which writes and reads binary data according to\n" +"the format string.\n" +"\n" +"See help(struct) for more on format strings."); + +static int +Struct___init___impl(PyStructObject *self, PyObject *format); + +static int +Struct___init__(PyObject *self, PyObject *args, PyObject *kwargs) +{ + int return_value = -1; + static const char * const _keywords[] = {"format", NULL}; + static _PyArg_Parser _parser = {"O:Struct", _keywords, 0}; + PyObject *format; + + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &format)) { + goto exit; + } + return_value = Struct___init___impl((PyStructObject *)self, format); + +exit: + return return_value; +} + +PyDoc_STRVAR(Struct_unpack__doc__, +"unpack($self, buffer, /)\n" +"--\n" +"\n" +"Return a tuple containing unpacked values.\n" +"\n" +"Unpack according to the format string Struct.format. The buffer\'s size\n" +"in bytes must be Struct.size.\n" +"\n" +"See help(struct) for more on format strings."); + +#define STRUCT_UNPACK_METHODDEF \ + {"unpack", (PyCFunction)Struct_unpack, METH_O, Struct_unpack__doc__}, + +static PyObject * +Struct_unpack_impl(PyStructObject *self, Py_buffer *buffer); + +static PyObject * +Struct_unpack(PyStructObject *self, PyObject *arg) +{ + PyObject *return_value = NULL; + Py_buffer buffer = {NULL, NULL}; + + if (!PyArg_Parse(arg, "y*:unpack", &buffer)) { + goto exit; + } + return_value = Struct_unpack_impl(self, &buffer); + +exit: + /* Cleanup for buffer */ + if (buffer.obj) { + PyBuffer_Release(&buffer); + } + + return return_value; +} + +PyDoc_STRVAR(Struct_unpack_from__doc__, +"unpack_from($self, /, buffer, offset=0)\n" +"--\n" +"\n" +"Return a tuple containing unpacked values.\n" +"\n" +"Values are unpacked according to the format string Struct.format.\n" +"\n" +"The buffer\'s size in bytes, minus offset, must be at least Struct.size.\n" +"\n" +"See help(struct) for more on format strings."); + +#define STRUCT_UNPACK_FROM_METHODDEF \ + {"unpack_from", (PyCFunction)Struct_unpack_from, METH_FASTCALL, Struct_unpack_from__doc__}, + +static PyObject * +Struct_unpack_from_impl(PyStructObject *self, Py_buffer *buffer, + Py_ssize_t offset); + +static PyObject * +Struct_unpack_from(PyStructObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + static const char * const _keywords[] = {"buffer", "offset", NULL}; + static _PyArg_Parser _parser = {"y*|n:unpack_from", _keywords, 0}; + Py_buffer buffer = {NULL, NULL}; + Py_ssize_t offset = 0; + + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &buffer, &offset)) { + goto exit; + } + return_value = Struct_unpack_from_impl(self, &buffer, offset); + +exit: + /* Cleanup for buffer */ + if (buffer.obj) { + PyBuffer_Release(&buffer); + } + + return return_value; +} + +PyDoc_STRVAR(Struct_iter_unpack__doc__, +"iter_unpack($self, buffer, /)\n" +"--\n" +"\n" +"Return an iterator yielding tuples.\n" +"\n" +"Tuples are unpacked from the given bytes source, like a repeated\n" +"invocation of unpack_from().\n" +"\n" +"Requires that the bytes length be a multiple of the struct size."); + +#define STRUCT_ITER_UNPACK_METHODDEF \ + {"iter_unpack", (PyCFunction)Struct_iter_unpack, METH_O, Struct_iter_unpack__doc__}, + +PyDoc_STRVAR(_clearcache__doc__, +"_clearcache($module, /)\n" +"--\n" +"\n" +"Clear the internal cache."); + +#define _CLEARCACHE_METHODDEF \ + {"_clearcache", (PyCFunction)_clearcache, METH_NOARGS, _clearcache__doc__}, + +static PyObject * +_clearcache_impl(PyObject *module); + +static PyObject * +_clearcache(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return _clearcache_impl(module); +} + +PyDoc_STRVAR(calcsize__doc__, +"calcsize($module, format, /)\n" +"--\n" +"\n" +"Return size in bytes of the struct described by the format string."); + +#define CALCSIZE_METHODDEF \ + {"calcsize", (PyCFunction)calcsize, METH_O, calcsize__doc__}, + +PyDoc_STRVAR(unpack__doc__, +"unpack($module, format, buffer, /)\n" +"--\n" +"\n" +"Return a tuple containing values unpacked according to the format string.\n" +"\n" +"The buffer\'s size in bytes must be calcsize(format).\n" +"\n" +"See help(struct) for more on format strings."); + +#define UNPACK_METHODDEF \ + {"unpack", (PyCFunction)unpack, METH_FASTCALL, unpack__doc__}, + +static PyObject * +unpack_impl(PyObject *module, PyObject *format, Py_buffer *buffer); + +static PyObject * +unpack(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *format; + Py_buffer buffer = {NULL, NULL}; + + if (!_PyArg_ParseStack(args, nargs, "Oy*:unpack", + &format, &buffer)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("unpack", kwnames)) { + goto exit; + } + return_value = unpack_impl(module, format, &buffer); + +exit: + /* Cleanup for buffer */ + if (buffer.obj) { + PyBuffer_Release(&buffer); + } + + return return_value; +} + +PyDoc_STRVAR(unpack_from__doc__, +"unpack_from($module, format, /, buffer, offset=0)\n" +"--\n" +"\n" +"Return a tuple containing values unpacked according to the format string.\n" +"\n" +"The buffer\'s size, minus offset, must be at least calcsize(format).\n" +"\n" +"See help(struct) for more on format strings."); + +#define UNPACK_FROM_METHODDEF \ + {"unpack_from", (PyCFunction)unpack_from, METH_FASTCALL, unpack_from__doc__}, + +static PyObject * +unpack_from_impl(PyObject *module, PyObject *format, Py_buffer *buffer, + Py_ssize_t offset); + +static PyObject * +unpack_from(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + static const char * const _keywords[] = {"", "buffer", "offset", NULL}; + static _PyArg_Parser _parser = {"Oy*|n:unpack_from", _keywords, 0}; + PyObject *format; + Py_buffer buffer = {NULL, NULL}; + Py_ssize_t offset = 0; + + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &format, &buffer, &offset)) { + goto exit; + } + return_value = unpack_from_impl(module, format, &buffer, offset); + +exit: + /* Cleanup for buffer */ + if (buffer.obj) { + PyBuffer_Release(&buffer); + } + + return return_value; +} + +PyDoc_STRVAR(iter_unpack__doc__, +"iter_unpack($module, format, buffer, /)\n" +"--\n" +"\n" +"Return an iterator yielding tuples unpacked from the given bytes.\n" +"\n" +"The bytes are unpacked according to the format string, like\n" +"a repeated invocation of unpack_from().\n" +"\n" +"Requires that the bytes length be a multiple of the format struct size."); + +#define ITER_UNPACK_METHODDEF \ + {"iter_unpack", (PyCFunction)iter_unpack, METH_FASTCALL, iter_unpack__doc__}, + +static PyObject * +iter_unpack_impl(PyObject *module, PyObject *format, PyObject *buffer); + +static PyObject * +iter_unpack(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *format; + PyObject *buffer; + + if (!_PyArg_UnpackStack(args, nargs, "iter_unpack", + 2, 2, + &format, &buffer)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("iter_unpack", kwnames)) { + goto exit; + } + return_value = iter_unpack_impl(module, format, buffer); + +exit: + return return_value; +} +/*[clinic end generated code: output=0714090a5d0ea8ce input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_tkinter.c.h b/Modules/clinic/_tkinter.c.h index edd5380005..5d75ec33b5 100644 --- a/Modules/clinic/_tkinter.c.h +++ b/Modules/clinic/_tkinter.c.h @@ -256,23 +256,27 @@ PyDoc_STRVAR(_tkinter_tkapp_createcommand__doc__, "\n"); #define _TKINTER_TKAPP_CREATECOMMAND_METHODDEF \ - {"createcommand", (PyCFunction)_tkinter_tkapp_createcommand, METH_VARARGS, _tkinter_tkapp_createcommand__doc__}, + {"createcommand", (PyCFunction)_tkinter_tkapp_createcommand, METH_FASTCALL, _tkinter_tkapp_createcommand__doc__}, static PyObject * _tkinter_tkapp_createcommand_impl(TkappObject *self, const char *name, PyObject *func); static PyObject * -_tkinter_tkapp_createcommand(TkappObject *self, PyObject *args) +_tkinter_tkapp_createcommand(TkappObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; const char *name; PyObject *func; - if (!PyArg_ParseTuple(args, "sO:createcommand", + if (!_PyArg_ParseStack(args, nargs, "sO:createcommand", &name, &func)) { goto exit; } + + if (!_PyArg_NoStackKeywords("createcommand", kwnames)) { + goto exit; + } return_value = _tkinter_tkapp_createcommand_impl(self, name, func); exit: @@ -313,24 +317,28 @@ PyDoc_STRVAR(_tkinter_tkapp_createfilehandler__doc__, "\n"); #define _TKINTER_TKAPP_CREATEFILEHANDLER_METHODDEF \ - {"createfilehandler", (PyCFunction)_tkinter_tkapp_createfilehandler, METH_VARARGS, _tkinter_tkapp_createfilehandler__doc__}, + {"createfilehandler", (PyCFunction)_tkinter_tkapp_createfilehandler, METH_FASTCALL, _tkinter_tkapp_createfilehandler__doc__}, static PyObject * _tkinter_tkapp_createfilehandler_impl(TkappObject *self, PyObject *file, int mask, PyObject *func); static PyObject * -_tkinter_tkapp_createfilehandler(TkappObject *self, PyObject *args) +_tkinter_tkapp_createfilehandler(TkappObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *file; int mask; PyObject *func; - if (!PyArg_ParseTuple(args, "OiO:createfilehandler", + if (!_PyArg_ParseStack(args, nargs, "OiO:createfilehandler", &file, &mask, &func)) { goto exit; } + + if (!_PyArg_NoStackKeywords("createfilehandler", kwnames)) { + goto exit; + } return_value = _tkinter_tkapp_createfilehandler_impl(self, file, mask, func); exit: @@ -374,23 +382,27 @@ PyDoc_STRVAR(_tkinter_tkapp_createtimerhandler__doc__, "\n"); #define _TKINTER_TKAPP_CREATETIMERHANDLER_METHODDEF \ - {"createtimerhandler", (PyCFunction)_tkinter_tkapp_createtimerhandler, METH_VARARGS, _tkinter_tkapp_createtimerhandler__doc__}, + {"createtimerhandler", (PyCFunction)_tkinter_tkapp_createtimerhandler, METH_FASTCALL, _tkinter_tkapp_createtimerhandler__doc__}, static PyObject * _tkinter_tkapp_createtimerhandler_impl(TkappObject *self, int milliseconds, PyObject *func); static PyObject * -_tkinter_tkapp_createtimerhandler(TkappObject *self, PyObject *args) +_tkinter_tkapp_createtimerhandler(TkappObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int milliseconds; PyObject *func; - if (!PyArg_ParseTuple(args, "iO:createtimerhandler", + if (!_PyArg_ParseStack(args, nargs, "iO:createtimerhandler", &milliseconds, &func)) { goto exit; } + + if (!_PyArg_NoStackKeywords("createtimerhandler", kwnames)) { + goto exit; + } return_value = _tkinter_tkapp_createtimerhandler_impl(self, milliseconds, func); exit: @@ -403,21 +415,25 @@ PyDoc_STRVAR(_tkinter_tkapp_mainloop__doc__, "\n"); #define _TKINTER_TKAPP_MAINLOOP_METHODDEF \ - {"mainloop", (PyCFunction)_tkinter_tkapp_mainloop, METH_VARARGS, _tkinter_tkapp_mainloop__doc__}, + {"mainloop", (PyCFunction)_tkinter_tkapp_mainloop, METH_FASTCALL, _tkinter_tkapp_mainloop__doc__}, static PyObject * _tkinter_tkapp_mainloop_impl(TkappObject *self, int threshold); static PyObject * -_tkinter_tkapp_mainloop(TkappObject *self, PyObject *args) +_tkinter_tkapp_mainloop(TkappObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int threshold = 0; - if (!PyArg_ParseTuple(args, "|i:mainloop", + if (!_PyArg_ParseStack(args, nargs, "|i:mainloop", &threshold)) { goto exit; } + + if (!_PyArg_NoStackKeywords("mainloop", kwnames)) { + goto exit; + } return_value = _tkinter_tkapp_mainloop_impl(self, threshold); exit: @@ -430,21 +446,25 @@ PyDoc_STRVAR(_tkinter_tkapp_dooneevent__doc__, "\n"); #define _TKINTER_TKAPP_DOONEEVENT_METHODDEF \ - {"dooneevent", (PyCFunction)_tkinter_tkapp_dooneevent, METH_VARARGS, _tkinter_tkapp_dooneevent__doc__}, + {"dooneevent", (PyCFunction)_tkinter_tkapp_dooneevent, METH_FASTCALL, _tkinter_tkapp_dooneevent__doc__}, static PyObject * _tkinter_tkapp_dooneevent_impl(TkappObject *self, int flags); static PyObject * -_tkinter_tkapp_dooneevent(TkappObject *self, PyObject *args) +_tkinter_tkapp_dooneevent(TkappObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int flags = 0; - if (!PyArg_ParseTuple(args, "|i:dooneevent", + if (!_PyArg_ParseStack(args, nargs, "|i:dooneevent", &flags)) { goto exit; } + + if (!_PyArg_NoStackKeywords("dooneevent", kwnames)) { + goto exit; + } return_value = _tkinter_tkapp_dooneevent_impl(self, flags); exit: @@ -543,7 +563,7 @@ PyDoc_STRVAR(_tkinter_create__doc__, " if not None, then pass -use to wish"); #define _TKINTER_CREATE_METHODDEF \ - {"create", (PyCFunction)_tkinter_create, METH_VARARGS, _tkinter_create__doc__}, + {"create", (PyCFunction)_tkinter_create, METH_FASTCALL, _tkinter_create__doc__}, static PyObject * _tkinter_create_impl(PyObject *module, const char *screenName, @@ -552,7 +572,7 @@ _tkinter_create_impl(PyObject *module, const char *screenName, const char *use); static PyObject * -_tkinter_create(PyObject *module, PyObject *args) +_tkinter_create(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; const char *screenName = NULL; @@ -564,10 +584,14 @@ _tkinter_create(PyObject *module, PyObject *args) int sync = 0; const char *use = NULL; - if (!PyArg_ParseTuple(args, "|zssiiiiz:create", + if (!_PyArg_ParseStack(args, nargs, "|zssiiiiz:create", &screenName, &baseName, &className, &interactive, &wantobjects, &wantTk, &sync, &use)) { goto exit; } + + if (!_PyArg_NoStackKeywords("create", kwnames)) { + goto exit; + } return_value = _tkinter_create_impl(module, screenName, baseName, className, interactive, wantobjects, wantTk, sync, use); exit: @@ -638,4 +662,4 @@ exit: #ifndef _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF #define _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF #endif /* !defined(_TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF) */ -/*[clinic end generated code: output=836c578b71d69097 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=328e29a146c4a63b input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_weakref.c.h b/Modules/clinic/_weakref.c.h index ab84c304d9..d847867c4c 100644 --- a/Modules/clinic/_weakref.c.h +++ b/Modules/clinic/_weakref.c.h @@ -37,26 +37,30 @@ PyDoc_STRVAR(_weakref__remove_dead_weakref__doc__, "Atomically remove key from dict if it points to a dead weakref."); #define _WEAKREF__REMOVE_DEAD_WEAKREF_METHODDEF \ - {"_remove_dead_weakref", (PyCFunction)_weakref__remove_dead_weakref, METH_VARARGS, _weakref__remove_dead_weakref__doc__}, + {"_remove_dead_weakref", (PyCFunction)_weakref__remove_dead_weakref, METH_FASTCALL, _weakref__remove_dead_weakref__doc__}, static PyObject * _weakref__remove_dead_weakref_impl(PyObject *module, PyObject *dct, PyObject *key); static PyObject * -_weakref__remove_dead_weakref(PyObject *module, PyObject *args) +_weakref__remove_dead_weakref(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *dct; PyObject *key; - if (!PyArg_ParseTuple(args, "O!O:_remove_dead_weakref", + if (!_PyArg_ParseStack(args, nargs, "O!O:_remove_dead_weakref", &PyDict_Type, &dct, &key)) { goto exit; } + + if (!_PyArg_NoStackKeywords("_remove_dead_weakref", kwnames)) { + goto exit; + } return_value = _weakref__remove_dead_weakref_impl(module, dct, key); exit: return return_value; } -/*[clinic end generated code: output=e860dd818a44bc9b input=a9049054013a1b77]*/ +/*[clinic end generated code: output=b686303486bdfefd input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_winapi.c.h b/Modules/clinic/_winapi.c.h index 5bfbaf0d56..431580293e 100644 --- a/Modules/clinic/_winapi.c.h +++ b/Modules/clinic/_winapi.c.h @@ -110,7 +110,7 @@ _winapi_ConnectNamedPipe(PyObject *module, PyObject **args, Py_ssize_t nargs, Py HANDLE handle; int use_overlapped = 0; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &handle, &use_overlapped)) { goto exit; } @@ -128,7 +128,7 @@ PyDoc_STRVAR(_winapi_CreateFile__doc__, "\n"); #define _WINAPI_CREATEFILE_METHODDEF \ - {"CreateFile", (PyCFunction)_winapi_CreateFile, METH_VARARGS, _winapi_CreateFile__doc__}, + {"CreateFile", (PyCFunction)_winapi_CreateFile, METH_FASTCALL, _winapi_CreateFile__doc__}, static HANDLE _winapi_CreateFile_impl(PyObject *module, LPCTSTR file_name, @@ -138,7 +138,7 @@ _winapi_CreateFile_impl(PyObject *module, LPCTSTR file_name, DWORD flags_and_attributes, HANDLE template_file); static PyObject * -_winapi_CreateFile(PyObject *module, PyObject *args) +_winapi_CreateFile(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; LPCTSTR file_name; @@ -150,10 +150,14 @@ _winapi_CreateFile(PyObject *module, PyObject *args) HANDLE template_file; HANDLE _return_value; - if (!PyArg_ParseTuple(args, "skk" F_POINTER "kk" F_HANDLE ":CreateFile", + if (!_PyArg_ParseStack(args, nargs, "skk" F_POINTER "kk" F_HANDLE ":CreateFile", &file_name, &desired_access, &share_mode, &security_attributes, &creation_disposition, &flags_and_attributes, &template_file)) { goto exit; } + + if (!_PyArg_NoStackKeywords("CreateFile", kwnames)) { + goto exit; + } _return_value = _winapi_CreateFile_impl(module, file_name, desired_access, share_mode, security_attributes, creation_disposition, flags_and_attributes, template_file); if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) { goto exit; @@ -173,23 +177,27 @@ PyDoc_STRVAR(_winapi_CreateJunction__doc__, "\n"); #define _WINAPI_CREATEJUNCTION_METHODDEF \ - {"CreateJunction", (PyCFunction)_winapi_CreateJunction, METH_VARARGS, _winapi_CreateJunction__doc__}, + {"CreateJunction", (PyCFunction)_winapi_CreateJunction, METH_FASTCALL, _winapi_CreateJunction__doc__}, static PyObject * _winapi_CreateJunction_impl(PyObject *module, LPWSTR src_path, LPWSTR dst_path); static PyObject * -_winapi_CreateJunction(PyObject *module, PyObject *args) +_winapi_CreateJunction(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; LPWSTR src_path; LPWSTR dst_path; - if (!PyArg_ParseTuple(args, "uu:CreateJunction", + if (!_PyArg_ParseStack(args, nargs, "uu:CreateJunction", &src_path, &dst_path)) { goto exit; } + + if (!_PyArg_NoStackKeywords("CreateJunction", kwnames)) { + goto exit; + } return_value = _winapi_CreateJunction_impl(module, src_path, dst_path); exit: @@ -204,7 +212,7 @@ PyDoc_STRVAR(_winapi_CreateNamedPipe__doc__, "\n"); #define _WINAPI_CREATENAMEDPIPE_METHODDEF \ - {"CreateNamedPipe", (PyCFunction)_winapi_CreateNamedPipe, METH_VARARGS, _winapi_CreateNamedPipe__doc__}, + {"CreateNamedPipe", (PyCFunction)_winapi_CreateNamedPipe, METH_FASTCALL, _winapi_CreateNamedPipe__doc__}, static HANDLE _winapi_CreateNamedPipe_impl(PyObject *module, LPCTSTR name, DWORD open_mode, @@ -214,7 +222,7 @@ _winapi_CreateNamedPipe_impl(PyObject *module, LPCTSTR name, DWORD open_mode, LPSECURITY_ATTRIBUTES security_attributes); static PyObject * -_winapi_CreateNamedPipe(PyObject *module, PyObject *args) +_winapi_CreateNamedPipe(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; LPCTSTR name; @@ -227,10 +235,14 @@ _winapi_CreateNamedPipe(PyObject *module, PyObject *args) LPSECURITY_ATTRIBUTES security_attributes; HANDLE _return_value; - if (!PyArg_ParseTuple(args, "skkkkkk" F_POINTER ":CreateNamedPipe", + if (!_PyArg_ParseStack(args, nargs, "skkkkkk" F_POINTER ":CreateNamedPipe", &name, &open_mode, &pipe_mode, &max_instances, &out_buffer_size, &in_buffer_size, &default_timeout, &security_attributes)) { goto exit; } + + if (!_PyArg_NoStackKeywords("CreateNamedPipe", kwnames)) { + goto exit; + } _return_value = _winapi_CreateNamedPipe_impl(module, name, open_mode, pipe_mode, max_instances, out_buffer_size, in_buffer_size, default_timeout, security_attributes); if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) { goto exit; @@ -256,22 +268,26 @@ PyDoc_STRVAR(_winapi_CreatePipe__doc__, "Returns a 2-tuple of handles, to the read and write ends of the pipe."); #define _WINAPI_CREATEPIPE_METHODDEF \ - {"CreatePipe", (PyCFunction)_winapi_CreatePipe, METH_VARARGS, _winapi_CreatePipe__doc__}, + {"CreatePipe", (PyCFunction)_winapi_CreatePipe, METH_FASTCALL, _winapi_CreatePipe__doc__}, static PyObject * _winapi_CreatePipe_impl(PyObject *module, PyObject *pipe_attrs, DWORD size); static PyObject * -_winapi_CreatePipe(PyObject *module, PyObject *args) +_winapi_CreatePipe(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *pipe_attrs; DWORD size; - if (!PyArg_ParseTuple(args, "Ok:CreatePipe", + if (!_PyArg_ParseStack(args, nargs, "Ok:CreatePipe", &pipe_attrs, &size)) { goto exit; } + + if (!_PyArg_NoStackKeywords("CreatePipe", kwnames)) { + goto exit; + } return_value = _winapi_CreatePipe_impl(module, pipe_attrs, size); exit: @@ -295,7 +311,7 @@ PyDoc_STRVAR(_winapi_CreateProcess__doc__, "process ID, and thread ID."); #define _WINAPI_CREATEPROCESS_METHODDEF \ - {"CreateProcess", (PyCFunction)_winapi_CreateProcess, METH_VARARGS, _winapi_CreateProcess__doc__}, + {"CreateProcess", (PyCFunction)_winapi_CreateProcess, METH_FASTCALL, _winapi_CreateProcess__doc__}, static PyObject * _winapi_CreateProcess_impl(PyObject *module, Py_UNICODE *application_name, @@ -306,7 +322,7 @@ _winapi_CreateProcess_impl(PyObject *module, Py_UNICODE *application_name, PyObject *startup_info); static PyObject * -_winapi_CreateProcess(PyObject *module, PyObject *args) +_winapi_CreateProcess(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_UNICODE *application_name; @@ -319,10 +335,14 @@ _winapi_CreateProcess(PyObject *module, PyObject *args) Py_UNICODE *current_directory; PyObject *startup_info; - if (!PyArg_ParseTuple(args, "ZZOOikOZO:CreateProcess", + if (!_PyArg_ParseStack(args, nargs, "ZZOOikOZO:CreateProcess", &application_name, &command_line, &proc_attrs, &thread_attrs, &inherit_handles, &creation_flags, &env_mapping, ¤t_directory, &startup_info)) { goto exit; } + + if (!_PyArg_NoStackKeywords("CreateProcess", kwnames)) { + goto exit; + } return_value = _winapi_CreateProcess_impl(module, application_name, command_line, proc_attrs, thread_attrs, inherit_handles, creation_flags, env_mapping, current_directory, startup_info); exit: @@ -342,7 +362,7 @@ PyDoc_STRVAR(_winapi_DuplicateHandle__doc__, "through both handles."); #define _WINAPI_DUPLICATEHANDLE_METHODDEF \ - {"DuplicateHandle", (PyCFunction)_winapi_DuplicateHandle, METH_VARARGS, _winapi_DuplicateHandle__doc__}, + {"DuplicateHandle", (PyCFunction)_winapi_DuplicateHandle, METH_FASTCALL, _winapi_DuplicateHandle__doc__}, static HANDLE _winapi_DuplicateHandle_impl(PyObject *module, HANDLE source_process_handle, @@ -352,7 +372,7 @@ _winapi_DuplicateHandle_impl(PyObject *module, HANDLE source_process_handle, DWORD options); static PyObject * -_winapi_DuplicateHandle(PyObject *module, PyObject *args) +_winapi_DuplicateHandle(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; HANDLE source_process_handle; @@ -363,10 +383,14 @@ _winapi_DuplicateHandle(PyObject *module, PyObject *args) DWORD options = 0; HANDLE _return_value; - if (!PyArg_ParseTuple(args, "" F_HANDLE "" F_HANDLE "" F_HANDLE "ki|k:DuplicateHandle", + if (!_PyArg_ParseStack(args, nargs, "" F_HANDLE "" F_HANDLE "" F_HANDLE "ki|k:DuplicateHandle", &source_process_handle, &source_handle, &target_process_handle, &desired_access, &inherit_handle, &options)) { goto exit; } + + if (!_PyArg_NoStackKeywords("DuplicateHandle", kwnames)) { + goto exit; + } _return_value = _winapi_DuplicateHandle_impl(module, source_process_handle, source_handle, target_process_handle, desired_access, inherit_handle, options); if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) { goto exit; @@ -604,14 +628,14 @@ PyDoc_STRVAR(_winapi_OpenProcess__doc__, "\n"); #define _WINAPI_OPENPROCESS_METHODDEF \ - {"OpenProcess", (PyCFunction)_winapi_OpenProcess, METH_VARARGS, _winapi_OpenProcess__doc__}, + {"OpenProcess", (PyCFunction)_winapi_OpenProcess, METH_FASTCALL, _winapi_OpenProcess__doc__}, static HANDLE _winapi_OpenProcess_impl(PyObject *module, DWORD desired_access, BOOL inherit_handle, DWORD process_id); static PyObject * -_winapi_OpenProcess(PyObject *module, PyObject *args) +_winapi_OpenProcess(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; DWORD desired_access; @@ -619,10 +643,14 @@ _winapi_OpenProcess(PyObject *module, PyObject *args) DWORD process_id; HANDLE _return_value; - if (!PyArg_ParseTuple(args, "kik:OpenProcess", + if (!_PyArg_ParseStack(args, nargs, "kik:OpenProcess", &desired_access, &inherit_handle, &process_id)) { goto exit; } + + if (!_PyArg_NoStackKeywords("OpenProcess", kwnames)) { + goto exit; + } _return_value = _winapi_OpenProcess_impl(module, desired_access, inherit_handle, process_id); if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) { goto exit; @@ -642,22 +670,26 @@ PyDoc_STRVAR(_winapi_PeekNamedPipe__doc__, "\n"); #define _WINAPI_PEEKNAMEDPIPE_METHODDEF \ - {"PeekNamedPipe", (PyCFunction)_winapi_PeekNamedPipe, METH_VARARGS, _winapi_PeekNamedPipe__doc__}, + {"PeekNamedPipe", (PyCFunction)_winapi_PeekNamedPipe, METH_FASTCALL, _winapi_PeekNamedPipe__doc__}, static PyObject * _winapi_PeekNamedPipe_impl(PyObject *module, HANDLE handle, int size); static PyObject * -_winapi_PeekNamedPipe(PyObject *module, PyObject *args) +_winapi_PeekNamedPipe(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; HANDLE handle; int size = 0; - if (!PyArg_ParseTuple(args, "" F_HANDLE "|i:PeekNamedPipe", + if (!_PyArg_ParseStack(args, nargs, "" F_HANDLE "|i:PeekNamedPipe", &handle, &size)) { goto exit; } + + if (!_PyArg_NoStackKeywords("PeekNamedPipe", kwnames)) { + goto exit; + } return_value = _winapi_PeekNamedPipe_impl(module, handle, size); exit: @@ -686,7 +718,7 @@ _winapi_ReadFile(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject * int size; int use_overlapped = 0; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &handle, &size, &use_overlapped)) { goto exit; } @@ -703,7 +735,7 @@ PyDoc_STRVAR(_winapi_SetNamedPipeHandleState__doc__, "\n"); #define _WINAPI_SETNAMEDPIPEHANDLESTATE_METHODDEF \ - {"SetNamedPipeHandleState", (PyCFunction)_winapi_SetNamedPipeHandleState, METH_VARARGS, _winapi_SetNamedPipeHandleState__doc__}, + {"SetNamedPipeHandleState", (PyCFunction)_winapi_SetNamedPipeHandleState, METH_FASTCALL, _winapi_SetNamedPipeHandleState__doc__}, static PyObject * _winapi_SetNamedPipeHandleState_impl(PyObject *module, HANDLE named_pipe, @@ -712,7 +744,7 @@ _winapi_SetNamedPipeHandleState_impl(PyObject *module, HANDLE named_pipe, PyObject *collect_data_timeout); static PyObject * -_winapi_SetNamedPipeHandleState(PyObject *module, PyObject *args) +_winapi_SetNamedPipeHandleState(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; HANDLE named_pipe; @@ -720,10 +752,14 @@ _winapi_SetNamedPipeHandleState(PyObject *module, PyObject *args) PyObject *max_collection_count; PyObject *collect_data_timeout; - if (!PyArg_ParseTuple(args, "" F_HANDLE "OOO:SetNamedPipeHandleState", + if (!_PyArg_ParseStack(args, nargs, "" F_HANDLE "OOO:SetNamedPipeHandleState", &named_pipe, &mode, &max_collection_count, &collect_data_timeout)) { goto exit; } + + if (!_PyArg_NoStackKeywords("SetNamedPipeHandleState", kwnames)) { + goto exit; + } return_value = _winapi_SetNamedPipeHandleState_impl(module, named_pipe, mode, max_collection_count, collect_data_timeout); exit: @@ -737,23 +773,27 @@ PyDoc_STRVAR(_winapi_TerminateProcess__doc__, "Terminate the specified process and all of its threads."); #define _WINAPI_TERMINATEPROCESS_METHODDEF \ - {"TerminateProcess", (PyCFunction)_winapi_TerminateProcess, METH_VARARGS, _winapi_TerminateProcess__doc__}, + {"TerminateProcess", (PyCFunction)_winapi_TerminateProcess, METH_FASTCALL, _winapi_TerminateProcess__doc__}, static PyObject * _winapi_TerminateProcess_impl(PyObject *module, HANDLE handle, UINT exit_code); static PyObject * -_winapi_TerminateProcess(PyObject *module, PyObject *args) +_winapi_TerminateProcess(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; HANDLE handle; UINT exit_code; - if (!PyArg_ParseTuple(args, "" F_HANDLE "I:TerminateProcess", + if (!_PyArg_ParseStack(args, nargs, "" F_HANDLE "I:TerminateProcess", &handle, &exit_code)) { goto exit; } + + if (!_PyArg_NoStackKeywords("TerminateProcess", kwnames)) { + goto exit; + } return_value = _winapi_TerminateProcess_impl(module, handle, exit_code); exit: @@ -766,22 +806,26 @@ PyDoc_STRVAR(_winapi_WaitNamedPipe__doc__, "\n"); #define _WINAPI_WAITNAMEDPIPE_METHODDEF \ - {"WaitNamedPipe", (PyCFunction)_winapi_WaitNamedPipe, METH_VARARGS, _winapi_WaitNamedPipe__doc__}, + {"WaitNamedPipe", (PyCFunction)_winapi_WaitNamedPipe, METH_FASTCALL, _winapi_WaitNamedPipe__doc__}, static PyObject * _winapi_WaitNamedPipe_impl(PyObject *module, LPCTSTR name, DWORD timeout); static PyObject * -_winapi_WaitNamedPipe(PyObject *module, PyObject *args) +_winapi_WaitNamedPipe(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; LPCTSTR name; DWORD timeout; - if (!PyArg_ParseTuple(args, "sk:WaitNamedPipe", + if (!_PyArg_ParseStack(args, nargs, "sk:WaitNamedPipe", &name, &timeout)) { goto exit; } + + if (!_PyArg_NoStackKeywords("WaitNamedPipe", kwnames)) { + goto exit; + } return_value = _winapi_WaitNamedPipe_impl(module, name, timeout); exit: @@ -795,24 +839,28 @@ PyDoc_STRVAR(_winapi_WaitForMultipleObjects__doc__, "\n"); #define _WINAPI_WAITFORMULTIPLEOBJECTS_METHODDEF \ - {"WaitForMultipleObjects", (PyCFunction)_winapi_WaitForMultipleObjects, METH_VARARGS, _winapi_WaitForMultipleObjects__doc__}, + {"WaitForMultipleObjects", (PyCFunction)_winapi_WaitForMultipleObjects, METH_FASTCALL, _winapi_WaitForMultipleObjects__doc__}, static PyObject * _winapi_WaitForMultipleObjects_impl(PyObject *module, PyObject *handle_seq, BOOL wait_flag, DWORD milliseconds); static PyObject * -_winapi_WaitForMultipleObjects(PyObject *module, PyObject *args) +_winapi_WaitForMultipleObjects(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *handle_seq; BOOL wait_flag; DWORD milliseconds = INFINITE; - if (!PyArg_ParseTuple(args, "Oi|k:WaitForMultipleObjects", + if (!_PyArg_ParseStack(args, nargs, "Oi|k:WaitForMultipleObjects", &handle_seq, &wait_flag, &milliseconds)) { goto exit; } + + if (!_PyArg_NoStackKeywords("WaitForMultipleObjects", kwnames)) { + goto exit; + } return_value = _winapi_WaitForMultipleObjects_impl(module, handle_seq, wait_flag, milliseconds); exit: @@ -830,24 +878,28 @@ PyDoc_STRVAR(_winapi_WaitForSingleObject__doc__, "in milliseconds."); #define _WINAPI_WAITFORSINGLEOBJECT_METHODDEF \ - {"WaitForSingleObject", (PyCFunction)_winapi_WaitForSingleObject, METH_VARARGS, _winapi_WaitForSingleObject__doc__}, + {"WaitForSingleObject", (PyCFunction)_winapi_WaitForSingleObject, METH_FASTCALL, _winapi_WaitForSingleObject__doc__}, static long _winapi_WaitForSingleObject_impl(PyObject *module, HANDLE handle, DWORD milliseconds); static PyObject * -_winapi_WaitForSingleObject(PyObject *module, PyObject *args) +_winapi_WaitForSingleObject(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; HANDLE handle; DWORD milliseconds; long _return_value; - if (!PyArg_ParseTuple(args, "" F_HANDLE "k:WaitForSingleObject", + if (!_PyArg_ParseStack(args, nargs, "" F_HANDLE "k:WaitForSingleObject", &handle, &milliseconds)) { goto exit; } + + if (!_PyArg_NoStackKeywords("WaitForSingleObject", kwnames)) { + goto exit; + } _return_value = _winapi_WaitForSingleObject_impl(module, handle, milliseconds); if ((_return_value == -1) && PyErr_Occurred()) { goto exit; @@ -880,7 +932,7 @@ _winapi_WriteFile(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject PyObject *buffer; int use_overlapped = 0; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &handle, &buffer, &use_overlapped)) { goto exit; } @@ -889,4 +941,4 @@ _winapi_WriteFile(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject exit: return return_value; } -/*[clinic end generated code: output=46d6382a6662c4a9 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=2beb984508fb040a input=a9049054013a1b77]*/ diff --git a/Modules/clinic/arraymodule.c.h b/Modules/clinic/arraymodule.c.h index 3b9fcdab0a..2a6767458e 100644 --- a/Modules/clinic/arraymodule.c.h +++ b/Modules/clinic/arraymodule.c.h @@ -65,21 +65,25 @@ PyDoc_STRVAR(array_array_pop__doc__, "i defaults to -1."); #define ARRAY_ARRAY_POP_METHODDEF \ - {"pop", (PyCFunction)array_array_pop, METH_VARARGS, array_array_pop__doc__}, + {"pop", (PyCFunction)array_array_pop, METH_FASTCALL, array_array_pop__doc__}, static PyObject * array_array_pop_impl(arrayobject *self, Py_ssize_t i); static PyObject * -array_array_pop(arrayobject *self, PyObject *args) +array_array_pop(arrayobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_ssize_t i = -1; - if (!PyArg_ParseTuple(args, "|n:pop", + if (!_PyArg_ParseStack(args, nargs, "|n:pop", &i)) { goto exit; } + + if (!_PyArg_NoStackKeywords("pop", kwnames)) { + goto exit; + } return_value = array_array_pop_impl(self, i); exit: @@ -102,22 +106,26 @@ PyDoc_STRVAR(array_array_insert__doc__, "Insert a new item v into the array before position i."); #define ARRAY_ARRAY_INSERT_METHODDEF \ - {"insert", (PyCFunction)array_array_insert, METH_VARARGS, array_array_insert__doc__}, + {"insert", (PyCFunction)array_array_insert, METH_FASTCALL, array_array_insert__doc__}, static PyObject * array_array_insert_impl(arrayobject *self, Py_ssize_t i, PyObject *v); static PyObject * -array_array_insert(arrayobject *self, PyObject *args) +array_array_insert(arrayobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_ssize_t i; PyObject *v; - if (!PyArg_ParseTuple(args, "nO:insert", + if (!_PyArg_ParseStack(args, nargs, "nO:insert", &i, &v)) { goto exit; } + + if (!_PyArg_NoStackKeywords("insert", kwnames)) { + goto exit; + } return_value = array_array_insert_impl(self, i, v); exit: @@ -200,22 +208,26 @@ PyDoc_STRVAR(array_array_fromfile__doc__, "Read n objects from the file object f and append them to the end of the array."); #define ARRAY_ARRAY_FROMFILE_METHODDEF \ - {"fromfile", (PyCFunction)array_array_fromfile, METH_VARARGS, array_array_fromfile__doc__}, + {"fromfile", (PyCFunction)array_array_fromfile, METH_FASTCALL, array_array_fromfile__doc__}, static PyObject * array_array_fromfile_impl(arrayobject *self, PyObject *f, Py_ssize_t n); static PyObject * -array_array_fromfile(arrayobject *self, PyObject *args) +array_array_fromfile(arrayobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *f; Py_ssize_t n; - if (!PyArg_ParseTuple(args, "On:fromfile", + if (!_PyArg_ParseStack(args, nargs, "On:fromfile", &f, &n)) { goto exit; } + + if (!_PyArg_NoStackKeywords("fromfile", kwnames)) { + goto exit; + } return_value = array_array_fromfile_impl(self, f, n); exit: @@ -443,7 +455,7 @@ PyDoc_STRVAR(array__array_reconstructor__doc__, "Internal. Used for pickling support."); #define ARRAY__ARRAY_RECONSTRUCTOR_METHODDEF \ - {"_array_reconstructor", (PyCFunction)array__array_reconstructor, METH_VARARGS, array__array_reconstructor__doc__}, + {"_array_reconstructor", (PyCFunction)array__array_reconstructor, METH_FASTCALL, array__array_reconstructor__doc__}, static PyObject * array__array_reconstructor_impl(PyObject *module, PyTypeObject *arraytype, @@ -452,7 +464,7 @@ array__array_reconstructor_impl(PyObject *module, PyTypeObject *arraytype, PyObject *items); static PyObject * -array__array_reconstructor(PyObject *module, PyObject *args) +array__array_reconstructor(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyTypeObject *arraytype; @@ -460,10 +472,14 @@ array__array_reconstructor(PyObject *module, PyObject *args) enum machine_format_code mformat_code; PyObject *items; - if (!PyArg_ParseTuple(args, "OCiO:_array_reconstructor", + if (!_PyArg_ParseStack(args, nargs, "OCiO:_array_reconstructor", &arraytype, &typecode, &mformat_code, &items)) { goto exit; } + + if (!_PyArg_NoStackKeywords("_array_reconstructor", kwnames)) { + goto exit; + } return_value = array__array_reconstructor_impl(module, arraytype, typecode, mformat_code, items); exit: @@ -505,4 +521,4 @@ PyDoc_STRVAR(array_arrayiterator___setstate____doc__, #define ARRAY_ARRAYITERATOR___SETSTATE___METHODDEF \ {"__setstate__", (PyCFunction)array_arrayiterator___setstate__, METH_O, array_arrayiterator___setstate____doc__}, -/*[clinic end generated code: output=b2054fb764c8cc64 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=d186a7553c1f1a41 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/audioop.c.h b/Modules/clinic/audioop.c.h index be4b718843..6ba1172e95 100644 --- a/Modules/clinic/audioop.c.h +++ b/Modules/clinic/audioop.c.h @@ -9,24 +9,28 @@ PyDoc_STRVAR(audioop_getsample__doc__, "Return the value of sample index from the fragment."); #define AUDIOOP_GETSAMPLE_METHODDEF \ - {"getsample", (PyCFunction)audioop_getsample, METH_VARARGS, audioop_getsample__doc__}, + {"getsample", (PyCFunction)audioop_getsample, METH_FASTCALL, audioop_getsample__doc__}, static PyObject * audioop_getsample_impl(PyObject *module, Py_buffer *fragment, int width, Py_ssize_t index); static PyObject * -audioop_getsample(PyObject *module, PyObject *args) +audioop_getsample(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer fragment = {NULL, NULL}; int width; Py_ssize_t index; - if (!PyArg_ParseTuple(args, "y*in:getsample", + if (!_PyArg_ParseStack(args, nargs, "y*in:getsample", &fragment, &width, &index)) { goto exit; } + + if (!_PyArg_NoStackKeywords("getsample", kwnames)) { + goto exit; + } return_value = audioop_getsample_impl(module, &fragment, width, index); exit: @@ -45,22 +49,26 @@ PyDoc_STRVAR(audioop_max__doc__, "Return the maximum of the absolute value of all samples in a fragment."); #define AUDIOOP_MAX_METHODDEF \ - {"max", (PyCFunction)audioop_max, METH_VARARGS, audioop_max__doc__}, + {"max", (PyCFunction)audioop_max, METH_FASTCALL, audioop_max__doc__}, static PyObject * audioop_max_impl(PyObject *module, Py_buffer *fragment, int width); static PyObject * -audioop_max(PyObject *module, PyObject *args) +audioop_max(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer fragment = {NULL, NULL}; int width; - if (!PyArg_ParseTuple(args, "y*i:max", + if (!_PyArg_ParseStack(args, nargs, "y*i:max", &fragment, &width)) { goto exit; } + + if (!_PyArg_NoStackKeywords("max", kwnames)) { + goto exit; + } return_value = audioop_max_impl(module, &fragment, width); exit: @@ -79,22 +87,26 @@ PyDoc_STRVAR(audioop_minmax__doc__, "Return the minimum and maximum values of all samples in the sound fragment."); #define AUDIOOP_MINMAX_METHODDEF \ - {"minmax", (PyCFunction)audioop_minmax, METH_VARARGS, audioop_minmax__doc__}, + {"minmax", (PyCFunction)audioop_minmax, METH_FASTCALL, audioop_minmax__doc__}, static PyObject * audioop_minmax_impl(PyObject *module, Py_buffer *fragment, int width); static PyObject * -audioop_minmax(PyObject *module, PyObject *args) +audioop_minmax(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer fragment = {NULL, NULL}; int width; - if (!PyArg_ParseTuple(args, "y*i:minmax", + if (!_PyArg_ParseStack(args, nargs, "y*i:minmax", &fragment, &width)) { goto exit; } + + if (!_PyArg_NoStackKeywords("minmax", kwnames)) { + goto exit; + } return_value = audioop_minmax_impl(module, &fragment, width); exit: @@ -113,22 +125,26 @@ PyDoc_STRVAR(audioop_avg__doc__, "Return the average over all samples in the fragment."); #define AUDIOOP_AVG_METHODDEF \ - {"avg", (PyCFunction)audioop_avg, METH_VARARGS, audioop_avg__doc__}, + {"avg", (PyCFunction)audioop_avg, METH_FASTCALL, audioop_avg__doc__}, static PyObject * audioop_avg_impl(PyObject *module, Py_buffer *fragment, int width); static PyObject * -audioop_avg(PyObject *module, PyObject *args) +audioop_avg(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer fragment = {NULL, NULL}; int width; - if (!PyArg_ParseTuple(args, "y*i:avg", + if (!_PyArg_ParseStack(args, nargs, "y*i:avg", &fragment, &width)) { goto exit; } + + if (!_PyArg_NoStackKeywords("avg", kwnames)) { + goto exit; + } return_value = audioop_avg_impl(module, &fragment, width); exit: @@ -147,22 +163,26 @@ PyDoc_STRVAR(audioop_rms__doc__, "Return the root-mean-square of the fragment, i.e. sqrt(sum(S_i^2)/n)."); #define AUDIOOP_RMS_METHODDEF \ - {"rms", (PyCFunction)audioop_rms, METH_VARARGS, audioop_rms__doc__}, + {"rms", (PyCFunction)audioop_rms, METH_FASTCALL, audioop_rms__doc__}, static PyObject * audioop_rms_impl(PyObject *module, Py_buffer *fragment, int width); static PyObject * -audioop_rms(PyObject *module, PyObject *args) +audioop_rms(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer fragment = {NULL, NULL}; int width; - if (!PyArg_ParseTuple(args, "y*i:rms", + if (!_PyArg_ParseStack(args, nargs, "y*i:rms", &fragment, &width)) { goto exit; } + + if (!_PyArg_NoStackKeywords("rms", kwnames)) { + goto exit; + } return_value = audioop_rms_impl(module, &fragment, width); exit: @@ -181,23 +201,27 @@ PyDoc_STRVAR(audioop_findfit__doc__, "Try to match reference as well as possible to a portion of fragment."); #define AUDIOOP_FINDFIT_METHODDEF \ - {"findfit", (PyCFunction)audioop_findfit, METH_VARARGS, audioop_findfit__doc__}, + {"findfit", (PyCFunction)audioop_findfit, METH_FASTCALL, audioop_findfit__doc__}, static PyObject * audioop_findfit_impl(PyObject *module, Py_buffer *fragment, Py_buffer *reference); static PyObject * -audioop_findfit(PyObject *module, PyObject *args) +audioop_findfit(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer fragment = {NULL, NULL}; Py_buffer reference = {NULL, NULL}; - if (!PyArg_ParseTuple(args, "y*y*:findfit", + if (!_PyArg_ParseStack(args, nargs, "y*y*:findfit", &fragment, &reference)) { goto exit; } + + if (!_PyArg_NoStackKeywords("findfit", kwnames)) { + goto exit; + } return_value = audioop_findfit_impl(module, &fragment, &reference); exit: @@ -220,23 +244,27 @@ PyDoc_STRVAR(audioop_findfactor__doc__, "Return a factor F such that rms(add(fragment, mul(reference, -F))) is minimal."); #define AUDIOOP_FINDFACTOR_METHODDEF \ - {"findfactor", (PyCFunction)audioop_findfactor, METH_VARARGS, audioop_findfactor__doc__}, + {"findfactor", (PyCFunction)audioop_findfactor, METH_FASTCALL, audioop_findfactor__doc__}, static PyObject * audioop_findfactor_impl(PyObject *module, Py_buffer *fragment, Py_buffer *reference); static PyObject * -audioop_findfactor(PyObject *module, PyObject *args) +audioop_findfactor(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer fragment = {NULL, NULL}; Py_buffer reference = {NULL, NULL}; - if (!PyArg_ParseTuple(args, "y*y*:findfactor", + if (!_PyArg_ParseStack(args, nargs, "y*y*:findfactor", &fragment, &reference)) { goto exit; } + + if (!_PyArg_NoStackKeywords("findfactor", kwnames)) { + goto exit; + } return_value = audioop_findfactor_impl(module, &fragment, &reference); exit: @@ -259,23 +287,27 @@ PyDoc_STRVAR(audioop_findmax__doc__, "Search fragment for a slice of specified number of samples with maximum energy."); #define AUDIOOP_FINDMAX_METHODDEF \ - {"findmax", (PyCFunction)audioop_findmax, METH_VARARGS, audioop_findmax__doc__}, + {"findmax", (PyCFunction)audioop_findmax, METH_FASTCALL, audioop_findmax__doc__}, static PyObject * audioop_findmax_impl(PyObject *module, Py_buffer *fragment, Py_ssize_t length); static PyObject * -audioop_findmax(PyObject *module, PyObject *args) +audioop_findmax(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer fragment = {NULL, NULL}; Py_ssize_t length; - if (!PyArg_ParseTuple(args, "y*n:findmax", + if (!_PyArg_ParseStack(args, nargs, "y*n:findmax", &fragment, &length)) { goto exit; } + + if (!_PyArg_NoStackKeywords("findmax", kwnames)) { + goto exit; + } return_value = audioop_findmax_impl(module, &fragment, length); exit: @@ -294,22 +326,26 @@ PyDoc_STRVAR(audioop_avgpp__doc__, "Return the average peak-peak value over all samples in the fragment."); #define AUDIOOP_AVGPP_METHODDEF \ - {"avgpp", (PyCFunction)audioop_avgpp, METH_VARARGS, audioop_avgpp__doc__}, + {"avgpp", (PyCFunction)audioop_avgpp, METH_FASTCALL, audioop_avgpp__doc__}, static PyObject * audioop_avgpp_impl(PyObject *module, Py_buffer *fragment, int width); static PyObject * -audioop_avgpp(PyObject *module, PyObject *args) +audioop_avgpp(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer fragment = {NULL, NULL}; int width; - if (!PyArg_ParseTuple(args, "y*i:avgpp", + if (!_PyArg_ParseStack(args, nargs, "y*i:avgpp", &fragment, &width)) { goto exit; } + + if (!_PyArg_NoStackKeywords("avgpp", kwnames)) { + goto exit; + } return_value = audioop_avgpp_impl(module, &fragment, width); exit: @@ -328,22 +364,26 @@ PyDoc_STRVAR(audioop_maxpp__doc__, "Return the maximum peak-peak value in the sound fragment."); #define AUDIOOP_MAXPP_METHODDEF \ - {"maxpp", (PyCFunction)audioop_maxpp, METH_VARARGS, audioop_maxpp__doc__}, + {"maxpp", (PyCFunction)audioop_maxpp, METH_FASTCALL, audioop_maxpp__doc__}, static PyObject * audioop_maxpp_impl(PyObject *module, Py_buffer *fragment, int width); static PyObject * -audioop_maxpp(PyObject *module, PyObject *args) +audioop_maxpp(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer fragment = {NULL, NULL}; int width; - if (!PyArg_ParseTuple(args, "y*i:maxpp", + if (!_PyArg_ParseStack(args, nargs, "y*i:maxpp", &fragment, &width)) { goto exit; } + + if (!_PyArg_NoStackKeywords("maxpp", kwnames)) { + goto exit; + } return_value = audioop_maxpp_impl(module, &fragment, width); exit: @@ -362,22 +402,26 @@ PyDoc_STRVAR(audioop_cross__doc__, "Return the number of zero crossings in the fragment passed as an argument."); #define AUDIOOP_CROSS_METHODDEF \ - {"cross", (PyCFunction)audioop_cross, METH_VARARGS, audioop_cross__doc__}, + {"cross", (PyCFunction)audioop_cross, METH_FASTCALL, audioop_cross__doc__}, static PyObject * audioop_cross_impl(PyObject *module, Py_buffer *fragment, int width); static PyObject * -audioop_cross(PyObject *module, PyObject *args) +audioop_cross(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer fragment = {NULL, NULL}; int width; - if (!PyArg_ParseTuple(args, "y*i:cross", + if (!_PyArg_ParseStack(args, nargs, "y*i:cross", &fragment, &width)) { goto exit; } + + if (!_PyArg_NoStackKeywords("cross", kwnames)) { + goto exit; + } return_value = audioop_cross_impl(module, &fragment, width); exit: @@ -396,24 +440,28 @@ PyDoc_STRVAR(audioop_mul__doc__, "Return a fragment that has all samples in the original fragment multiplied by the floating-point value factor."); #define AUDIOOP_MUL_METHODDEF \ - {"mul", (PyCFunction)audioop_mul, METH_VARARGS, audioop_mul__doc__}, + {"mul", (PyCFunction)audioop_mul, METH_FASTCALL, audioop_mul__doc__}, static PyObject * audioop_mul_impl(PyObject *module, Py_buffer *fragment, int width, double factor); static PyObject * -audioop_mul(PyObject *module, PyObject *args) +audioop_mul(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer fragment = {NULL, NULL}; int width; double factor; - if (!PyArg_ParseTuple(args, "y*id:mul", + if (!_PyArg_ParseStack(args, nargs, "y*id:mul", &fragment, &width, &factor)) { goto exit; } + + if (!_PyArg_NoStackKeywords("mul", kwnames)) { + goto exit; + } return_value = audioop_mul_impl(module, &fragment, width, factor); exit: @@ -432,14 +480,14 @@ PyDoc_STRVAR(audioop_tomono__doc__, "Convert a stereo fragment to a mono fragment."); #define AUDIOOP_TOMONO_METHODDEF \ - {"tomono", (PyCFunction)audioop_tomono, METH_VARARGS, audioop_tomono__doc__}, + {"tomono", (PyCFunction)audioop_tomono, METH_FASTCALL, audioop_tomono__doc__}, static PyObject * audioop_tomono_impl(PyObject *module, Py_buffer *fragment, int width, double lfactor, double rfactor); static PyObject * -audioop_tomono(PyObject *module, PyObject *args) +audioop_tomono(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer fragment = {NULL, NULL}; @@ -447,10 +495,14 @@ audioop_tomono(PyObject *module, PyObject *args) double lfactor; double rfactor; - if (!PyArg_ParseTuple(args, "y*idd:tomono", + if (!_PyArg_ParseStack(args, nargs, "y*idd:tomono", &fragment, &width, &lfactor, &rfactor)) { goto exit; } + + if (!_PyArg_NoStackKeywords("tomono", kwnames)) { + goto exit; + } return_value = audioop_tomono_impl(module, &fragment, width, lfactor, rfactor); exit: @@ -469,14 +521,14 @@ PyDoc_STRVAR(audioop_tostereo__doc__, "Generate a stereo fragment from a mono fragment."); #define AUDIOOP_TOSTEREO_METHODDEF \ - {"tostereo", (PyCFunction)audioop_tostereo, METH_VARARGS, audioop_tostereo__doc__}, + {"tostereo", (PyCFunction)audioop_tostereo, METH_FASTCALL, audioop_tostereo__doc__}, static PyObject * audioop_tostereo_impl(PyObject *module, Py_buffer *fragment, int width, double lfactor, double rfactor); static PyObject * -audioop_tostereo(PyObject *module, PyObject *args) +audioop_tostereo(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer fragment = {NULL, NULL}; @@ -484,10 +536,14 @@ audioop_tostereo(PyObject *module, PyObject *args) double lfactor; double rfactor; - if (!PyArg_ParseTuple(args, "y*idd:tostereo", + if (!_PyArg_ParseStack(args, nargs, "y*idd:tostereo", &fragment, &width, &lfactor, &rfactor)) { goto exit; } + + if (!_PyArg_NoStackKeywords("tostereo", kwnames)) { + goto exit; + } return_value = audioop_tostereo_impl(module, &fragment, width, lfactor, rfactor); exit: @@ -506,24 +562,28 @@ PyDoc_STRVAR(audioop_add__doc__, "Return a fragment which is the addition of the two samples passed as parameters."); #define AUDIOOP_ADD_METHODDEF \ - {"add", (PyCFunction)audioop_add, METH_VARARGS, audioop_add__doc__}, + {"add", (PyCFunction)audioop_add, METH_FASTCALL, audioop_add__doc__}, static PyObject * audioop_add_impl(PyObject *module, Py_buffer *fragment1, Py_buffer *fragment2, int width); static PyObject * -audioop_add(PyObject *module, PyObject *args) +audioop_add(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer fragment1 = {NULL, NULL}; Py_buffer fragment2 = {NULL, NULL}; int width; - if (!PyArg_ParseTuple(args, "y*y*i:add", + if (!_PyArg_ParseStack(args, nargs, "y*y*i:add", &fragment1, &fragment2, &width)) { goto exit; } + + if (!_PyArg_NoStackKeywords("add", kwnames)) { + goto exit; + } return_value = audioop_add_impl(module, &fragment1, &fragment2, width); exit: @@ -546,23 +606,27 @@ PyDoc_STRVAR(audioop_bias__doc__, "Return a fragment that is the original fragment with a bias added to each sample."); #define AUDIOOP_BIAS_METHODDEF \ - {"bias", (PyCFunction)audioop_bias, METH_VARARGS, audioop_bias__doc__}, + {"bias", (PyCFunction)audioop_bias, METH_FASTCALL, audioop_bias__doc__}, static PyObject * audioop_bias_impl(PyObject *module, Py_buffer *fragment, int width, int bias); static PyObject * -audioop_bias(PyObject *module, PyObject *args) +audioop_bias(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer fragment = {NULL, NULL}; int width; int bias; - if (!PyArg_ParseTuple(args, "y*ii:bias", + if (!_PyArg_ParseStack(args, nargs, "y*ii:bias", &fragment, &width, &bias)) { goto exit; } + + if (!_PyArg_NoStackKeywords("bias", kwnames)) { + goto exit; + } return_value = audioop_bias_impl(module, &fragment, width, bias); exit: @@ -581,22 +645,26 @@ PyDoc_STRVAR(audioop_reverse__doc__, "Reverse the samples in a fragment and returns the modified fragment."); #define AUDIOOP_REVERSE_METHODDEF \ - {"reverse", (PyCFunction)audioop_reverse, METH_VARARGS, audioop_reverse__doc__}, + {"reverse", (PyCFunction)audioop_reverse, METH_FASTCALL, audioop_reverse__doc__}, static PyObject * audioop_reverse_impl(PyObject *module, Py_buffer *fragment, int width); static PyObject * -audioop_reverse(PyObject *module, PyObject *args) +audioop_reverse(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer fragment = {NULL, NULL}; int width; - if (!PyArg_ParseTuple(args, "y*i:reverse", + if (!_PyArg_ParseStack(args, nargs, "y*i:reverse", &fragment, &width)) { goto exit; } + + if (!_PyArg_NoStackKeywords("reverse", kwnames)) { + goto exit; + } return_value = audioop_reverse_impl(module, &fragment, width); exit: @@ -615,22 +683,26 @@ PyDoc_STRVAR(audioop_byteswap__doc__, "Convert big-endian samples to little-endian and vice versa."); #define AUDIOOP_BYTESWAP_METHODDEF \ - {"byteswap", (PyCFunction)audioop_byteswap, METH_VARARGS, audioop_byteswap__doc__}, + {"byteswap", (PyCFunction)audioop_byteswap, METH_FASTCALL, audioop_byteswap__doc__}, static PyObject * audioop_byteswap_impl(PyObject *module, Py_buffer *fragment, int width); static PyObject * -audioop_byteswap(PyObject *module, PyObject *args) +audioop_byteswap(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer fragment = {NULL, NULL}; int width; - if (!PyArg_ParseTuple(args, "y*i:byteswap", + if (!_PyArg_ParseStack(args, nargs, "y*i:byteswap", &fragment, &width)) { goto exit; } + + if (!_PyArg_NoStackKeywords("byteswap", kwnames)) { + goto exit; + } return_value = audioop_byteswap_impl(module, &fragment, width); exit: @@ -649,24 +721,28 @@ PyDoc_STRVAR(audioop_lin2lin__doc__, "Convert samples between 1-, 2-, 3- and 4-byte formats."); #define AUDIOOP_LIN2LIN_METHODDEF \ - {"lin2lin", (PyCFunction)audioop_lin2lin, METH_VARARGS, audioop_lin2lin__doc__}, + {"lin2lin", (PyCFunction)audioop_lin2lin, METH_FASTCALL, audioop_lin2lin__doc__}, static PyObject * audioop_lin2lin_impl(PyObject *module, Py_buffer *fragment, int width, int newwidth); static PyObject * -audioop_lin2lin(PyObject *module, PyObject *args) +audioop_lin2lin(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer fragment = {NULL, NULL}; int width; int newwidth; - if (!PyArg_ParseTuple(args, "y*ii:lin2lin", + if (!_PyArg_ParseStack(args, nargs, "y*ii:lin2lin", &fragment, &width, &newwidth)) { goto exit; } + + if (!_PyArg_NoStackKeywords("lin2lin", kwnames)) { + goto exit; + } return_value = audioop_lin2lin_impl(module, &fragment, width, newwidth); exit: @@ -686,7 +762,7 @@ PyDoc_STRVAR(audioop_ratecv__doc__, "Convert the frame rate of the input fragment."); #define AUDIOOP_RATECV_METHODDEF \ - {"ratecv", (PyCFunction)audioop_ratecv, METH_VARARGS, audioop_ratecv__doc__}, + {"ratecv", (PyCFunction)audioop_ratecv, METH_FASTCALL, audioop_ratecv__doc__}, static PyObject * audioop_ratecv_impl(PyObject *module, Py_buffer *fragment, int width, @@ -694,7 +770,7 @@ audioop_ratecv_impl(PyObject *module, Py_buffer *fragment, int width, int weightA, int weightB); static PyObject * -audioop_ratecv(PyObject *module, PyObject *args) +audioop_ratecv(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer fragment = {NULL, NULL}; @@ -706,10 +782,14 @@ audioop_ratecv(PyObject *module, PyObject *args) int weightA = 1; int weightB = 0; - if (!PyArg_ParseTuple(args, "y*iiiiO|ii:ratecv", + if (!_PyArg_ParseStack(args, nargs, "y*iiiiO|ii:ratecv", &fragment, &width, &nchannels, &inrate, &outrate, &state, &weightA, &weightB)) { goto exit; } + + if (!_PyArg_NoStackKeywords("ratecv", kwnames)) { + goto exit; + } return_value = audioop_ratecv_impl(module, &fragment, width, nchannels, inrate, outrate, state, weightA, weightB); exit: @@ -728,22 +808,26 @@ PyDoc_STRVAR(audioop_lin2ulaw__doc__, "Convert samples in the audio fragment to u-LAW encoding."); #define AUDIOOP_LIN2ULAW_METHODDEF \ - {"lin2ulaw", (PyCFunction)audioop_lin2ulaw, METH_VARARGS, audioop_lin2ulaw__doc__}, + {"lin2ulaw", (PyCFunction)audioop_lin2ulaw, METH_FASTCALL, audioop_lin2ulaw__doc__}, static PyObject * audioop_lin2ulaw_impl(PyObject *module, Py_buffer *fragment, int width); static PyObject * -audioop_lin2ulaw(PyObject *module, PyObject *args) +audioop_lin2ulaw(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer fragment = {NULL, NULL}; int width; - if (!PyArg_ParseTuple(args, "y*i:lin2ulaw", + if (!_PyArg_ParseStack(args, nargs, "y*i:lin2ulaw", &fragment, &width)) { goto exit; } + + if (!_PyArg_NoStackKeywords("lin2ulaw", kwnames)) { + goto exit; + } return_value = audioop_lin2ulaw_impl(module, &fragment, width); exit: @@ -762,22 +846,26 @@ PyDoc_STRVAR(audioop_ulaw2lin__doc__, "Convert sound fragments in u-LAW encoding to linearly encoded sound fragments."); #define AUDIOOP_ULAW2LIN_METHODDEF \ - {"ulaw2lin", (PyCFunction)audioop_ulaw2lin, METH_VARARGS, audioop_ulaw2lin__doc__}, + {"ulaw2lin", (PyCFunction)audioop_ulaw2lin, METH_FASTCALL, audioop_ulaw2lin__doc__}, static PyObject * audioop_ulaw2lin_impl(PyObject *module, Py_buffer *fragment, int width); static PyObject * -audioop_ulaw2lin(PyObject *module, PyObject *args) +audioop_ulaw2lin(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer fragment = {NULL, NULL}; int width; - if (!PyArg_ParseTuple(args, "y*i:ulaw2lin", + if (!_PyArg_ParseStack(args, nargs, "y*i:ulaw2lin", &fragment, &width)) { goto exit; } + + if (!_PyArg_NoStackKeywords("ulaw2lin", kwnames)) { + goto exit; + } return_value = audioop_ulaw2lin_impl(module, &fragment, width); exit: @@ -796,22 +884,26 @@ PyDoc_STRVAR(audioop_lin2alaw__doc__, "Convert samples in the audio fragment to a-LAW encoding."); #define AUDIOOP_LIN2ALAW_METHODDEF \ - {"lin2alaw", (PyCFunction)audioop_lin2alaw, METH_VARARGS, audioop_lin2alaw__doc__}, + {"lin2alaw", (PyCFunction)audioop_lin2alaw, METH_FASTCALL, audioop_lin2alaw__doc__}, static PyObject * audioop_lin2alaw_impl(PyObject *module, Py_buffer *fragment, int width); static PyObject * -audioop_lin2alaw(PyObject *module, PyObject *args) +audioop_lin2alaw(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer fragment = {NULL, NULL}; int width; - if (!PyArg_ParseTuple(args, "y*i:lin2alaw", + if (!_PyArg_ParseStack(args, nargs, "y*i:lin2alaw", &fragment, &width)) { goto exit; } + + if (!_PyArg_NoStackKeywords("lin2alaw", kwnames)) { + goto exit; + } return_value = audioop_lin2alaw_impl(module, &fragment, width); exit: @@ -830,22 +922,26 @@ PyDoc_STRVAR(audioop_alaw2lin__doc__, "Convert sound fragments in a-LAW encoding to linearly encoded sound fragments."); #define AUDIOOP_ALAW2LIN_METHODDEF \ - {"alaw2lin", (PyCFunction)audioop_alaw2lin, METH_VARARGS, audioop_alaw2lin__doc__}, + {"alaw2lin", (PyCFunction)audioop_alaw2lin, METH_FASTCALL, audioop_alaw2lin__doc__}, static PyObject * audioop_alaw2lin_impl(PyObject *module, Py_buffer *fragment, int width); static PyObject * -audioop_alaw2lin(PyObject *module, PyObject *args) +audioop_alaw2lin(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer fragment = {NULL, NULL}; int width; - if (!PyArg_ParseTuple(args, "y*i:alaw2lin", + if (!_PyArg_ParseStack(args, nargs, "y*i:alaw2lin", &fragment, &width)) { goto exit; } + + if (!_PyArg_NoStackKeywords("alaw2lin", kwnames)) { + goto exit; + } return_value = audioop_alaw2lin_impl(module, &fragment, width); exit: @@ -864,24 +960,28 @@ PyDoc_STRVAR(audioop_lin2adpcm__doc__, "Convert samples to 4 bit Intel/DVI ADPCM encoding."); #define AUDIOOP_LIN2ADPCM_METHODDEF \ - {"lin2adpcm", (PyCFunction)audioop_lin2adpcm, METH_VARARGS, audioop_lin2adpcm__doc__}, + {"lin2adpcm", (PyCFunction)audioop_lin2adpcm, METH_FASTCALL, audioop_lin2adpcm__doc__}, static PyObject * audioop_lin2adpcm_impl(PyObject *module, Py_buffer *fragment, int width, PyObject *state); static PyObject * -audioop_lin2adpcm(PyObject *module, PyObject *args) +audioop_lin2adpcm(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer fragment = {NULL, NULL}; int width; PyObject *state; - if (!PyArg_ParseTuple(args, "y*iO:lin2adpcm", + if (!_PyArg_ParseStack(args, nargs, "y*iO:lin2adpcm", &fragment, &width, &state)) { goto exit; } + + if (!_PyArg_NoStackKeywords("lin2adpcm", kwnames)) { + goto exit; + } return_value = audioop_lin2adpcm_impl(module, &fragment, width, state); exit: @@ -900,24 +1000,28 @@ PyDoc_STRVAR(audioop_adpcm2lin__doc__, "Decode an Intel/DVI ADPCM coded fragment to a linear fragment."); #define AUDIOOP_ADPCM2LIN_METHODDEF \ - {"adpcm2lin", (PyCFunction)audioop_adpcm2lin, METH_VARARGS, audioop_adpcm2lin__doc__}, + {"adpcm2lin", (PyCFunction)audioop_adpcm2lin, METH_FASTCALL, audioop_adpcm2lin__doc__}, static PyObject * audioop_adpcm2lin_impl(PyObject *module, Py_buffer *fragment, int width, PyObject *state); static PyObject * -audioop_adpcm2lin(PyObject *module, PyObject *args) +audioop_adpcm2lin(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer fragment = {NULL, NULL}; int width; PyObject *state; - if (!PyArg_ParseTuple(args, "y*iO:adpcm2lin", + if (!_PyArg_ParseStack(args, nargs, "y*iO:adpcm2lin", &fragment, &width, &state)) { goto exit; } + + if (!_PyArg_NoStackKeywords("adpcm2lin", kwnames)) { + goto exit; + } return_value = audioop_adpcm2lin_impl(module, &fragment, width, state); exit: @@ -928,4 +1032,4 @@ exit: return return_value; } -/*[clinic end generated code: output=e0ab74c3fa57c39c input=a9049054013a1b77]*/ +/*[clinic end generated code: output=ee7c63ec28a11b78 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/binascii.c.h b/Modules/clinic/binascii.c.h index 743bf46ea8..093d32bb23 100644 --- a/Modules/clinic/binascii.c.h +++ b/Modules/clinic/binascii.c.h @@ -117,7 +117,7 @@ binascii_b2a_base64(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObjec Py_buffer data = {NULL, NULL}; int newline = 1; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &data, &newline)) { goto exit; } @@ -266,23 +266,27 @@ PyDoc_STRVAR(binascii_crc_hqx__doc__, "Compute CRC-CCITT incrementally."); #define BINASCII_CRC_HQX_METHODDEF \ - {"crc_hqx", (PyCFunction)binascii_crc_hqx, METH_VARARGS, binascii_crc_hqx__doc__}, + {"crc_hqx", (PyCFunction)binascii_crc_hqx, METH_FASTCALL, binascii_crc_hqx__doc__}, static unsigned int binascii_crc_hqx_impl(PyObject *module, Py_buffer *data, unsigned int crc); static PyObject * -binascii_crc_hqx(PyObject *module, PyObject *args) +binascii_crc_hqx(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; unsigned int crc; unsigned int _return_value; - if (!PyArg_ParseTuple(args, "y*I:crc_hqx", + if (!_PyArg_ParseStack(args, nargs, "y*I:crc_hqx", &data, &crc)) { goto exit; } + + if (!_PyArg_NoStackKeywords("crc_hqx", kwnames)) { + goto exit; + } _return_value = binascii_crc_hqx_impl(module, &data, crc); if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) { goto exit; @@ -305,23 +309,27 @@ PyDoc_STRVAR(binascii_crc32__doc__, "Compute CRC-32 incrementally."); #define BINASCII_CRC32_METHODDEF \ - {"crc32", (PyCFunction)binascii_crc32, METH_VARARGS, binascii_crc32__doc__}, + {"crc32", (PyCFunction)binascii_crc32, METH_FASTCALL, binascii_crc32__doc__}, static unsigned int binascii_crc32_impl(PyObject *module, Py_buffer *data, unsigned int crc); static PyObject * -binascii_crc32(PyObject *module, PyObject *args) +binascii_crc32(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; unsigned int crc = 0; unsigned int _return_value; - if (!PyArg_ParseTuple(args, "y*|I:crc32", + if (!_PyArg_ParseStack(args, nargs, "y*|I:crc32", &data, &crc)) { goto exit; } + + if (!_PyArg_NoStackKeywords("crc32", kwnames)) { + goto exit; + } _return_value = binascii_crc32_impl(module, &data, crc); if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) { goto exit; @@ -494,7 +502,7 @@ binascii_a2b_qp(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *k Py_buffer data = {NULL, NULL}; int header = 0; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, ascii_buffer_converter, &data, &header)) { goto exit; } @@ -536,7 +544,7 @@ binascii_b2a_qp(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *k int istext = 1; int header = 0; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &data, "etabs, &istext, &header)) { goto exit; } @@ -550,4 +558,4 @@ exit: return return_value; } -/*[clinic end generated code: output=458eb09731cb7877 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=4a418f883ccc79fe input=a9049054013a1b77]*/ diff --git a/Modules/clinic/cmathmodule.c.h b/Modules/clinic/cmathmodule.c.h index 05431fa7af..b7a37270df 100644 --- a/Modules/clinic/cmathmodule.c.h +++ b/Modules/clinic/cmathmodule.c.h @@ -641,22 +641,26 @@ PyDoc_STRVAR(cmath_log__doc__, "If the base not specified, returns the natural logarithm (base e) of z."); #define CMATH_LOG_METHODDEF \ - {"log", (PyCFunction)cmath_log, METH_VARARGS, cmath_log__doc__}, + {"log", (PyCFunction)cmath_log, METH_FASTCALL, cmath_log__doc__}, static PyObject * cmath_log_impl(PyObject *module, Py_complex x, PyObject *y_obj); static PyObject * -cmath_log(PyObject *module, PyObject *args) +cmath_log(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_complex x; PyObject *y_obj = NULL; - if (!PyArg_ParseTuple(args, "D|O:log", + if (!_PyArg_ParseStack(args, nargs, "D|O:log", &x, &y_obj)) { goto exit; } + + if (!_PyArg_NoStackKeywords("log", kwnames)) { + goto exit; + } return_value = cmath_log_impl(module, x, y_obj); exit: @@ -726,22 +730,26 @@ PyDoc_STRVAR(cmath_rect__doc__, "Convert from polar coordinates to rectangular coordinates."); #define CMATH_RECT_METHODDEF \ - {"rect", (PyCFunction)cmath_rect, METH_VARARGS, cmath_rect__doc__}, + {"rect", (PyCFunction)cmath_rect, METH_FASTCALL, cmath_rect__doc__}, static PyObject * cmath_rect_impl(PyObject *module, double r, double phi); static PyObject * -cmath_rect(PyObject *module, PyObject *args) +cmath_rect(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; double r; double phi; - if (!PyArg_ParseTuple(args, "dd:rect", + if (!_PyArg_ParseStack(args, nargs, "dd:rect", &r, &phi)) { goto exit; } + + if (!_PyArg_NoStackKeywords("rect", kwnames)) { + goto exit; + } return_value = cmath_rect_impl(module, r, phi); exit: @@ -869,7 +877,7 @@ cmath_isclose(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwn double abs_tol = 0.0; int _return_value; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &a, &b, &rel_tol, &abs_tol)) { goto exit; } @@ -882,4 +890,4 @@ cmath_isclose(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwn exit: return return_value; } -/*[clinic end generated code: output=978f59702b41655f input=a9049054013a1b77]*/ +/*[clinic end generated code: output=93eff5d4c242ee57 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/fcntlmodule.c.h b/Modules/clinic/fcntlmodule.c.h index 84a004bb59..ed8d96a4a8 100644 --- a/Modules/clinic/fcntlmodule.c.h +++ b/Modules/clinic/fcntlmodule.c.h @@ -19,23 +19,27 @@ PyDoc_STRVAR(fcntl_fcntl__doc__, "corresponding to the return value of the fcntl call in the C code."); #define FCNTL_FCNTL_METHODDEF \ - {"fcntl", (PyCFunction)fcntl_fcntl, METH_VARARGS, fcntl_fcntl__doc__}, + {"fcntl", (PyCFunction)fcntl_fcntl, METH_FASTCALL, fcntl_fcntl__doc__}, static PyObject * fcntl_fcntl_impl(PyObject *module, int fd, int code, PyObject *arg); static PyObject * -fcntl_fcntl(PyObject *module, PyObject *args) +fcntl_fcntl(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; int code; PyObject *arg = NULL; - if (!PyArg_ParseTuple(args, "O&i|O:fcntl", + if (!_PyArg_ParseStack(args, nargs, "O&i|O:fcntl", conv_descriptor, &fd, &code, &arg)) { goto exit; } + + if (!_PyArg_NoStackKeywords("fcntl", kwnames)) { + goto exit; + } return_value = fcntl_fcntl_impl(module, fd, code, arg); exit: @@ -76,14 +80,14 @@ PyDoc_STRVAR(fcntl_ioctl__doc__, "code."); #define FCNTL_IOCTL_METHODDEF \ - {"ioctl", (PyCFunction)fcntl_ioctl, METH_VARARGS, fcntl_ioctl__doc__}, + {"ioctl", (PyCFunction)fcntl_ioctl, METH_FASTCALL, fcntl_ioctl__doc__}, static PyObject * fcntl_ioctl_impl(PyObject *module, int fd, unsigned int code, PyObject *ob_arg, int mutate_arg); static PyObject * -fcntl_ioctl(PyObject *module, PyObject *args) +fcntl_ioctl(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; @@ -91,10 +95,14 @@ fcntl_ioctl(PyObject *module, PyObject *args) PyObject *ob_arg = NULL; int mutate_arg = 1; - if (!PyArg_ParseTuple(args, "O&I|Op:ioctl", + if (!_PyArg_ParseStack(args, nargs, "O&I|Op:ioctl", conv_descriptor, &fd, &code, &ob_arg, &mutate_arg)) { goto exit; } + + if (!_PyArg_NoStackKeywords("ioctl", kwnames)) { + goto exit; + } return_value = fcntl_ioctl_impl(module, fd, code, ob_arg, mutate_arg); exit: @@ -111,22 +119,26 @@ PyDoc_STRVAR(fcntl_flock__doc__, "function is emulated using fcntl())."); #define FCNTL_FLOCK_METHODDEF \ - {"flock", (PyCFunction)fcntl_flock, METH_VARARGS, fcntl_flock__doc__}, + {"flock", (PyCFunction)fcntl_flock, METH_FASTCALL, fcntl_flock__doc__}, static PyObject * fcntl_flock_impl(PyObject *module, int fd, int code); static PyObject * -fcntl_flock(PyObject *module, PyObject *args) +fcntl_flock(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; int code; - if (!PyArg_ParseTuple(args, "O&i:flock", + if (!_PyArg_ParseStack(args, nargs, "O&i:flock", conv_descriptor, &fd, &code)) { goto exit; } + + if (!_PyArg_NoStackKeywords("flock", kwnames)) { + goto exit; + } return_value = fcntl_flock_impl(module, fd, code); exit: @@ -161,14 +173,14 @@ PyDoc_STRVAR(fcntl_lockf__doc__, " 2 - relative to the end of the file (SEEK_END)"); #define FCNTL_LOCKF_METHODDEF \ - {"lockf", (PyCFunction)fcntl_lockf, METH_VARARGS, fcntl_lockf__doc__}, + {"lockf", (PyCFunction)fcntl_lockf, METH_FASTCALL, fcntl_lockf__doc__}, static PyObject * fcntl_lockf_impl(PyObject *module, int fd, int code, PyObject *lenobj, PyObject *startobj, int whence); static PyObject * -fcntl_lockf(PyObject *module, PyObject *args) +fcntl_lockf(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; @@ -177,13 +189,17 @@ fcntl_lockf(PyObject *module, PyObject *args) PyObject *startobj = NULL; int whence = 0; - if (!PyArg_ParseTuple(args, "O&i|OOi:lockf", + if (!_PyArg_ParseStack(args, nargs, "O&i|OOi:lockf", conv_descriptor, &fd, &code, &lenobj, &startobj, &whence)) { goto exit; } + + if (!_PyArg_NoStackKeywords("lockf", kwnames)) { + goto exit; + } return_value = fcntl_lockf_impl(module, fd, code, lenobj, startobj, whence); exit: return return_value; } -/*[clinic end generated code: output=36cff76a8fb2c9a6 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=b67e9579722e6d4f input=a9049054013a1b77]*/ diff --git a/Modules/clinic/grpmodule.c.h b/Modules/clinic/grpmodule.c.h index 0282b4e477..73af272ba9 100644 --- a/Modules/clinic/grpmodule.c.h +++ b/Modules/clinic/grpmodule.c.h @@ -24,7 +24,7 @@ grp_getgrgid(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwna static _PyArg_Parser _parser = {"O:getgrgid", _keywords, 0}; PyObject *id; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &id)) { goto exit; } @@ -56,7 +56,7 @@ grp_getgrnam(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwna static _PyArg_Parser _parser = {"U:getgrnam", _keywords, 0}; PyObject *name; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &name)) { goto exit; } @@ -86,4 +86,4 @@ grp_getgrall(PyObject *module, PyObject *Py_UNUSED(ignored)) { return grp_getgrall_impl(module); } -/*[clinic end generated code: output=d6417ae0a7298e0e input=a9049054013a1b77]*/ +/*[clinic end generated code: output=fb690db5e676d378 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/mathmodule.c.h b/Modules/clinic/mathmodule.c.h new file mode 100644 index 0000000000..84a7a70cdc --- /dev/null +++ b/Modules/clinic/mathmodule.c.h @@ -0,0 +1,539 @@ +/*[clinic input] +preserve +[clinic start generated code]*/ + +PyDoc_STRVAR(math_gcd__doc__, +"gcd($module, x, y, /)\n" +"--\n" +"\n" +"greatest common divisor of x and y"); + +#define MATH_GCD_METHODDEF \ + {"gcd", (PyCFunction)math_gcd, METH_FASTCALL, math_gcd__doc__}, + +static PyObject * +math_gcd_impl(PyObject *module, PyObject *a, PyObject *b); + +static PyObject * +math_gcd(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *a; + PyObject *b; + + if (!_PyArg_UnpackStack(args, nargs, "gcd", + 2, 2, + &a, &b)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("gcd", kwnames)) { + goto exit; + } + return_value = math_gcd_impl(module, a, b); + +exit: + return return_value; +} + +PyDoc_STRVAR(math_ceil__doc__, +"ceil($module, x, /)\n" +"--\n" +"\n" +"Return the ceiling of x as an Integral.\n" +"\n" +"This is the smallest integer >= x."); + +#define MATH_CEIL_METHODDEF \ + {"ceil", (PyCFunction)math_ceil, METH_O, math_ceil__doc__}, + +PyDoc_STRVAR(math_floor__doc__, +"floor($module, x, /)\n" +"--\n" +"\n" +"Return the floor of x as an Integral.\n" +"\n" +"This is the largest integer <= x."); + +#define MATH_FLOOR_METHODDEF \ + {"floor", (PyCFunction)math_floor, METH_O, math_floor__doc__}, + +PyDoc_STRVAR(math_fsum__doc__, +"fsum($module, seq, /)\n" +"--\n" +"\n" +"Return an accurate floating point sum of values in the iterable seq.\n" +"\n" +"Assumes IEEE-754 floating point arithmetic."); + +#define MATH_FSUM_METHODDEF \ + {"fsum", (PyCFunction)math_fsum, METH_O, math_fsum__doc__}, + +PyDoc_STRVAR(math_factorial__doc__, +"factorial($module, x, /)\n" +"--\n" +"\n" +"Find x!.\n" +"\n" +"Raise a ValueError if x is negative or non-integral."); + +#define MATH_FACTORIAL_METHODDEF \ + {"factorial", (PyCFunction)math_factorial, METH_O, math_factorial__doc__}, + +PyDoc_STRVAR(math_trunc__doc__, +"trunc($module, x, /)\n" +"--\n" +"\n" +"Truncates the Real x to the nearest Integral toward 0.\n" +"\n" +"Uses the __trunc__ magic method."); + +#define MATH_TRUNC_METHODDEF \ + {"trunc", (PyCFunction)math_trunc, METH_O, math_trunc__doc__}, + +PyDoc_STRVAR(math_frexp__doc__, +"frexp($module, x, /)\n" +"--\n" +"\n" +"Return the mantissa and exponent of x, as pair (m, e).\n" +"\n" +"m is a float and e is an int, such that x = m * 2.**e.\n" +"If x is 0, m and e are both 0. Else 0.5 <= abs(m) < 1.0."); + +#define MATH_FREXP_METHODDEF \ + {"frexp", (PyCFunction)math_frexp, METH_O, math_frexp__doc__}, + +static PyObject * +math_frexp_impl(PyObject *module, double x); + +static PyObject * +math_frexp(PyObject *module, PyObject *arg) +{ + PyObject *return_value = NULL; + double x; + + if (!PyArg_Parse(arg, "d:frexp", &x)) { + goto exit; + } + return_value = math_frexp_impl(module, x); + +exit: + return return_value; +} + +PyDoc_STRVAR(math_ldexp__doc__, +"ldexp($module, x, i, /)\n" +"--\n" +"\n" +"Return x * (2**i).\n" +"\n" +"This is essentially the inverse of frexp()."); + +#define MATH_LDEXP_METHODDEF \ + {"ldexp", (PyCFunction)math_ldexp, METH_FASTCALL, math_ldexp__doc__}, + +static PyObject * +math_ldexp_impl(PyObject *module, double x, PyObject *i); + +static PyObject * +math_ldexp(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + double x; + PyObject *i; + + if (!_PyArg_ParseStack(args, nargs, "dO:ldexp", + &x, &i)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("ldexp", kwnames)) { + goto exit; + } + return_value = math_ldexp_impl(module, x, i); + +exit: + return return_value; +} + +PyDoc_STRVAR(math_modf__doc__, +"modf($module, x, /)\n" +"--\n" +"\n" +"Return the fractional and integer parts of x.\n" +"\n" +"Both results carry the sign of x and are floats."); + +#define MATH_MODF_METHODDEF \ + {"modf", (PyCFunction)math_modf, METH_O, math_modf__doc__}, + +static PyObject * +math_modf_impl(PyObject *module, double x); + +static PyObject * +math_modf(PyObject *module, PyObject *arg) +{ + PyObject *return_value = NULL; + double x; + + if (!PyArg_Parse(arg, "d:modf", &x)) { + goto exit; + } + return_value = math_modf_impl(module, x); + +exit: + return return_value; +} + +PyDoc_STRVAR(math_log__doc__, +"log(x, [base=math.e])\n" +"Return the logarithm of x to the given base.\n" +"\n" +"If the base not specified, returns the natural logarithm (base e) of x."); + +#define MATH_LOG_METHODDEF \ + {"log", (PyCFunction)math_log, METH_VARARGS, math_log__doc__}, + +static PyObject * +math_log_impl(PyObject *module, PyObject *x, int group_right_1, + PyObject *base); + +static PyObject * +math_log(PyObject *module, PyObject *args) +{ + PyObject *return_value = NULL; + PyObject *x; + int group_right_1 = 0; + PyObject *base = NULL; + + switch (PyTuple_GET_SIZE(args)) { + case 1: + if (!PyArg_ParseTuple(args, "O:log", &x)) { + goto exit; + } + break; + case 2: + if (!PyArg_ParseTuple(args, "OO:log", &x, &base)) { + goto exit; + } + group_right_1 = 1; + break; + default: + PyErr_SetString(PyExc_TypeError, "math.log requires 1 to 2 arguments"); + goto exit; + } + return_value = math_log_impl(module, x, group_right_1, base); + +exit: + return return_value; +} + +PyDoc_STRVAR(math_log2__doc__, +"log2($module, x, /)\n" +"--\n" +"\n" +"Return the base 2 logarithm of x."); + +#define MATH_LOG2_METHODDEF \ + {"log2", (PyCFunction)math_log2, METH_O, math_log2__doc__}, + +PyDoc_STRVAR(math_log10__doc__, +"log10($module, x, /)\n" +"--\n" +"\n" +"Return the base 10 logarithm of x."); + +#define MATH_LOG10_METHODDEF \ + {"log10", (PyCFunction)math_log10, METH_O, math_log10__doc__}, + +PyDoc_STRVAR(math_fmod__doc__, +"fmod($module, x, y, /)\n" +"--\n" +"\n" +"Return fmod(x, y), according to platform C.\n" +"\n" +"x % y may differ."); + +#define MATH_FMOD_METHODDEF \ + {"fmod", (PyCFunction)math_fmod, METH_FASTCALL, math_fmod__doc__}, + +static PyObject * +math_fmod_impl(PyObject *module, double x, double y); + +static PyObject * +math_fmod(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + double x; + double y; + + if (!_PyArg_ParseStack(args, nargs, "dd:fmod", + &x, &y)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("fmod", kwnames)) { + goto exit; + } + return_value = math_fmod_impl(module, x, y); + +exit: + return return_value; +} + +PyDoc_STRVAR(math_hypot__doc__, +"hypot($module, x, y, /)\n" +"--\n" +"\n" +"Return the Euclidean distance, sqrt(x*x + y*y)."); + +#define MATH_HYPOT_METHODDEF \ + {"hypot", (PyCFunction)math_hypot, METH_FASTCALL, math_hypot__doc__}, + +static PyObject * +math_hypot_impl(PyObject *module, double x, double y); + +static PyObject * +math_hypot(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + double x; + double y; + + if (!_PyArg_ParseStack(args, nargs, "dd:hypot", + &x, &y)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("hypot", kwnames)) { + goto exit; + } + return_value = math_hypot_impl(module, x, y); + +exit: + return return_value; +} + +PyDoc_STRVAR(math_pow__doc__, +"pow($module, x, y, /)\n" +"--\n" +"\n" +"Return x**y (x to the power of y)."); + +#define MATH_POW_METHODDEF \ + {"pow", (PyCFunction)math_pow, METH_FASTCALL, math_pow__doc__}, + +static PyObject * +math_pow_impl(PyObject *module, double x, double y); + +static PyObject * +math_pow(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + double x; + double y; + + if (!_PyArg_ParseStack(args, nargs, "dd:pow", + &x, &y)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("pow", kwnames)) { + goto exit; + } + return_value = math_pow_impl(module, x, y); + +exit: + return return_value; +} + +PyDoc_STRVAR(math_degrees__doc__, +"degrees($module, x, /)\n" +"--\n" +"\n" +"Convert angle x from radians to degrees."); + +#define MATH_DEGREES_METHODDEF \ + {"degrees", (PyCFunction)math_degrees, METH_O, math_degrees__doc__}, + +static PyObject * +math_degrees_impl(PyObject *module, double x); + +static PyObject * +math_degrees(PyObject *module, PyObject *arg) +{ + PyObject *return_value = NULL; + double x; + + if (!PyArg_Parse(arg, "d:degrees", &x)) { + goto exit; + } + return_value = math_degrees_impl(module, x); + +exit: + return return_value; +} + +PyDoc_STRVAR(math_radians__doc__, +"radians($module, x, /)\n" +"--\n" +"\n" +"Convert angle x from degrees to radians."); + +#define MATH_RADIANS_METHODDEF \ + {"radians", (PyCFunction)math_radians, METH_O, math_radians__doc__}, + +static PyObject * +math_radians_impl(PyObject *module, double x); + +static PyObject * +math_radians(PyObject *module, PyObject *arg) +{ + PyObject *return_value = NULL; + double x; + + if (!PyArg_Parse(arg, "d:radians", &x)) { + goto exit; + } + return_value = math_radians_impl(module, x); + +exit: + return return_value; +} + +PyDoc_STRVAR(math_isfinite__doc__, +"isfinite($module, x, /)\n" +"--\n" +"\n" +"Return True if x is neither an infinity nor a NaN, and False otherwise."); + +#define MATH_ISFINITE_METHODDEF \ + {"isfinite", (PyCFunction)math_isfinite, METH_O, math_isfinite__doc__}, + +static PyObject * +math_isfinite_impl(PyObject *module, double x); + +static PyObject * +math_isfinite(PyObject *module, PyObject *arg) +{ + PyObject *return_value = NULL; + double x; + + if (!PyArg_Parse(arg, "d:isfinite", &x)) { + goto exit; + } + return_value = math_isfinite_impl(module, x); + +exit: + return return_value; +} + +PyDoc_STRVAR(math_isnan__doc__, +"isnan($module, x, /)\n" +"--\n" +"\n" +"Return True if x is a NaN (not a number), and False otherwise."); + +#define MATH_ISNAN_METHODDEF \ + {"isnan", (PyCFunction)math_isnan, METH_O, math_isnan__doc__}, + +static PyObject * +math_isnan_impl(PyObject *module, double x); + +static PyObject * +math_isnan(PyObject *module, PyObject *arg) +{ + PyObject *return_value = NULL; + double x; + + if (!PyArg_Parse(arg, "d:isnan", &x)) { + goto exit; + } + return_value = math_isnan_impl(module, x); + +exit: + return return_value; +} + +PyDoc_STRVAR(math_isinf__doc__, +"isinf($module, x, /)\n" +"--\n" +"\n" +"Return True if x is a positive or negative infinity, and False otherwise."); + +#define MATH_ISINF_METHODDEF \ + {"isinf", (PyCFunction)math_isinf, METH_O, math_isinf__doc__}, + +static PyObject * +math_isinf_impl(PyObject *module, double x); + +static PyObject * +math_isinf(PyObject *module, PyObject *arg) +{ + PyObject *return_value = NULL; + double x; + + if (!PyArg_Parse(arg, "d:isinf", &x)) { + goto exit; + } + return_value = math_isinf_impl(module, x); + +exit: + return return_value; +} + +PyDoc_STRVAR(math_isclose__doc__, +"isclose($module, /, a, b, *, rel_tol=1e-09, abs_tol=0.0)\n" +"--\n" +"\n" +"Determine whether two floating point numbers are close in value.\n" +"\n" +" rel_tol\n" +" maximum difference for being considered \"close\", relative to the\n" +" magnitude of the input values\n" +" abs_tol\n" +" maximum difference for being considered \"close\", regardless of the\n" +" magnitude of the input values\n" +"\n" +"Return True if a is close in value to b, and False otherwise.\n" +"\n" +"For the values to be considered close, the difference between them\n" +"must be smaller than at least one of the tolerances.\n" +"\n" +"-inf, inf and NaN behave similarly to the IEEE 754 Standard. That\n" +"is, NaN is not close to anything, even itself. inf and -inf are\n" +"only close to themselves."); + +#define MATH_ISCLOSE_METHODDEF \ + {"isclose", (PyCFunction)math_isclose, METH_FASTCALL, math_isclose__doc__}, + +static int +math_isclose_impl(PyObject *module, double a, double b, double rel_tol, + double abs_tol); + +static PyObject * +math_isclose(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + static const char * const _keywords[] = {"a", "b", "rel_tol", "abs_tol", NULL}; + static _PyArg_Parser _parser = {"dd|$dd:isclose", _keywords, 0}; + double a; + double b; + double rel_tol = 1e-09; + double abs_tol = 0.0; + int _return_value; + + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &a, &b, &rel_tol, &abs_tol)) { + goto exit; + } + _return_value = math_isclose_impl(module, a, b, rel_tol, abs_tol); + if ((_return_value == -1) && PyErr_Occurred()) { + goto exit; + } + return_value = PyBool_FromLong((long)_return_value); + +exit: + return return_value; +} +/*[clinic end generated code: output=71806f73a5c4bf0b input=a9049054013a1b77]*/ diff --git a/Modules/clinic/md5module.c.h b/Modules/clinic/md5module.c.h index a841fe5786..3f80af4131 100644 --- a/Modules/clinic/md5module.c.h +++ b/Modules/clinic/md5module.c.h @@ -85,7 +85,7 @@ _md5_md5(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) static _PyArg_Parser _parser = {"|O:md5", _keywords, 0}; PyObject *string = NULL; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &string)) { goto exit; } @@ -94,4 +94,4 @@ _md5_md5(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) exit: return return_value; } -/*[clinic end generated code: output=54cd50db050f2589 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=0a975e22cf33f833 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h index 0d3ce6eed6..39ac7fd54f 100644 --- a/Modules/clinic/posixmodule.c.h +++ b/Modules/clinic/posixmodule.c.h @@ -43,7 +43,7 @@ os_stat(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) int dir_fd = DEFAULT_DIR_FD; int follow_symlinks = 1; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, FSTATAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) { goto exit; } @@ -80,7 +80,7 @@ os_lstat(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) path_t path = PATH_T_INITIALIZE("lstat", "path", 0, 0); int dir_fd = DEFAULT_DIR_FD; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, FSTATAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; } @@ -145,7 +145,7 @@ os_access(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames int follow_symlinks = 1; int _return_value; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, &mode, FACCESSAT_DIR_FD_CONVERTER, &dir_fd, &effective_ids, &follow_symlinks)) { goto exit; } @@ -247,7 +247,7 @@ os_chdir(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) static _PyArg_Parser _parser = {"O&:chdir", _keywords, 0}; path_t path = PATH_T_INITIALIZE("chdir", "path", 0, PATH_HAVE_FCHDIR); - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path)) { goto exit; } @@ -285,7 +285,7 @@ os_fchdir(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames static _PyArg_Parser _parser = {"O&:fchdir", _keywords, 0}; int fd; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, fildes_converter, &fd)) { goto exit; } @@ -341,7 +341,7 @@ os_chmod(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) int dir_fd = DEFAULT_DIR_FD; int follow_symlinks = 1; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, &mode, FCHMODAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) { goto exit; } @@ -379,7 +379,7 @@ os_fchmod(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames int fd; int mode; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &fd, &mode)) { goto exit; } @@ -417,7 +417,7 @@ os_lchmod(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames path_t path = PATH_T_INITIALIZE("lchmod", "path", 0, 0); int mode; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, &mode)) { goto exit; } @@ -463,7 +463,7 @@ os_chflags(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwname unsigned long flags; int follow_symlinks = 1; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, &flags, &follow_symlinks)) { goto exit; } @@ -504,7 +504,7 @@ os_lchflags(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnam path_t path = PATH_T_INITIALIZE("lchflags", "path", 0, 0); unsigned long flags; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, &flags)) { goto exit; } @@ -541,7 +541,7 @@ os_chroot(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames static _PyArg_Parser _parser = {"O&:chroot", _keywords, 0}; path_t path = PATH_T_INITIALIZE("chroot", "path", 0, 0); - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path)) { goto exit; } @@ -578,7 +578,7 @@ os_fsync(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) static _PyArg_Parser _parser = {"O&:fsync", _keywords, 0}; int fd; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, fildes_converter, &fd)) { goto exit; } @@ -634,7 +634,7 @@ os_fdatasync(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwna static _PyArg_Parser _parser = {"O&:fdatasync", _keywords, 0}; int fd; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, fildes_converter, &fd)) { goto exit; } @@ -697,7 +697,7 @@ os_chown(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) int dir_fd = DEFAULT_DIR_FD; int follow_symlinks = 1; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid, FCHOWNAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) { goto exit; } @@ -738,7 +738,7 @@ os_fchown(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames uid_t uid; gid_t gid; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &fd, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid)) { goto exit; } @@ -777,7 +777,7 @@ os_lchown(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames uid_t uid; gid_t gid; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid)) { goto exit; } @@ -866,7 +866,7 @@ os_link(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) int dst_dir_fd = DEFAULT_DIR_FD; int follow_symlinks = 1; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &src, path_converter, &dst, dir_fd_converter, &src_dir_fd, dir_fd_converter, &dst_dir_fd, &follow_symlinks)) { goto exit; } @@ -914,7 +914,7 @@ os_listdir(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwname static _PyArg_Parser _parser = {"|O&:listdir", _keywords, 0}; path_t path = PATH_T_INITIALIZE("listdir", "path", 1, PATH_HAVE_FDOPENDIR); - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path)) { goto exit; } @@ -1047,7 +1047,7 @@ os__getvolumepathname(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObj static _PyArg_Parser _parser = {"U:_getvolumepathname", _keywords, 0}; PyObject *path; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &path)) { goto exit; } @@ -1088,7 +1088,7 @@ os_mkdir(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) int mode = 511; int dir_fd = DEFAULT_DIR_FD; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, &mode, MKDIRAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; } @@ -1155,7 +1155,7 @@ os_getpriority(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kw int which; int who; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &which, &who)) { goto exit; } @@ -1191,7 +1191,7 @@ os_setpriority(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kw int who; int priority; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &which, &who, &priority)) { goto exit; } @@ -1233,7 +1233,7 @@ os_rename(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames int src_dir_fd = DEFAULT_DIR_FD; int dst_dir_fd = DEFAULT_DIR_FD; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &src, path_converter, &dst, dir_fd_converter, &src_dir_fd, dir_fd_converter, &dst_dir_fd)) { goto exit; } @@ -1278,7 +1278,7 @@ os_replace(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwname int src_dir_fd = DEFAULT_DIR_FD; int dst_dir_fd = DEFAULT_DIR_FD; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &src, path_converter, &dst, dir_fd_converter, &src_dir_fd, dir_fd_converter, &dst_dir_fd)) { goto exit; } @@ -1319,7 +1319,7 @@ os_rmdir(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) path_t path = PATH_T_INITIALIZE("rmdir", "path", 0, 0); int dir_fd = DEFAULT_DIR_FD; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; } @@ -1355,7 +1355,7 @@ os_system(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames Py_UNICODE *command; long _return_value; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &command)) { goto exit; } @@ -1394,7 +1394,7 @@ os_system(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames PyObject *command = NULL; long _return_value; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, PyUnicode_FSConverter, &command)) { goto exit; } @@ -1466,7 +1466,7 @@ os_unlink(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames path_t path = PATH_T_INITIALIZE("unlink", "path", 0, 0); int dir_fd = DEFAULT_DIR_FD; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; } @@ -1505,7 +1505,7 @@ os_remove(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames path_t path = PATH_T_INITIALIZE("remove", "path", 0, 0); int dir_fd = DEFAULT_DIR_FD; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; } @@ -1591,7 +1591,7 @@ os_utime(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) int dir_fd = DEFAULT_DIR_FD; int follow_symlinks = 1; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, ×, &ns, FUTIMENSAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) { goto exit; } @@ -1624,7 +1624,7 @@ os__exit(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) static _PyArg_Parser _parser = {"i:_exit", _keywords, 0}; int status; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &status)) { goto exit; } @@ -1648,22 +1648,26 @@ PyDoc_STRVAR(os_execv__doc__, " Tuple or list of strings."); #define OS_EXECV_METHODDEF \ - {"execv", (PyCFunction)os_execv, METH_VARARGS, os_execv__doc__}, + {"execv", (PyCFunction)os_execv, METH_FASTCALL, os_execv__doc__}, static PyObject * os_execv_impl(PyObject *module, path_t *path, PyObject *argv); static PyObject * -os_execv(PyObject *module, PyObject *args) +os_execv(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; path_t path = PATH_T_INITIALIZE("execv", "path", 0, 0); PyObject *argv; - if (!PyArg_ParseTuple(args, "O&O:execv", + if (!_PyArg_ParseStack(args, nargs, "O&O:execv", path_converter, &path, &argv)) { goto exit; } + + if (!_PyArg_NoStackKeywords("execv", kwnames)) { + goto exit; + } return_value = os_execv_impl(module, &path, argv); exit: @@ -1706,7 +1710,7 @@ os_execve(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames PyObject *argv; PyObject *env; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, &argv, &env)) { goto exit; } @@ -1737,23 +1741,27 @@ PyDoc_STRVAR(os_spawnv__doc__, " Tuple or list of strings."); #define OS_SPAWNV_METHODDEF \ - {"spawnv", (PyCFunction)os_spawnv, METH_VARARGS, os_spawnv__doc__}, + {"spawnv", (PyCFunction)os_spawnv, METH_FASTCALL, os_spawnv__doc__}, static PyObject * os_spawnv_impl(PyObject *module, int mode, path_t *path, PyObject *argv); static PyObject * -os_spawnv(PyObject *module, PyObject *args) +os_spawnv(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int mode; path_t path = PATH_T_INITIALIZE("spawnv", "path", 0, 0); PyObject *argv; - if (!PyArg_ParseTuple(args, "iO&O:spawnv", + if (!_PyArg_ParseStack(args, nargs, "iO&O:spawnv", &mode, path_converter, &path, &argv)) { goto exit; } + + if (!_PyArg_NoStackKeywords("spawnv", kwnames)) { + goto exit; + } return_value = os_spawnv_impl(module, mode, &path, argv); exit: @@ -1783,14 +1791,14 @@ PyDoc_STRVAR(os_spawnve__doc__, " Dictionary of strings mapping to strings."); #define OS_SPAWNVE_METHODDEF \ - {"spawnve", (PyCFunction)os_spawnve, METH_VARARGS, os_spawnve__doc__}, + {"spawnve", (PyCFunction)os_spawnve, METH_FASTCALL, os_spawnve__doc__}, static PyObject * os_spawnve_impl(PyObject *module, int mode, path_t *path, PyObject *argv, PyObject *env); static PyObject * -os_spawnve(PyObject *module, PyObject *args) +os_spawnve(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int mode; @@ -1798,10 +1806,14 @@ os_spawnve(PyObject *module, PyObject *args) PyObject *argv; PyObject *env; - if (!PyArg_ParseTuple(args, "iO&OO:spawnve", + if (!_PyArg_ParseStack(args, nargs, "iO&OO:spawnve", &mode, path_converter, &path, &argv, &env)) { goto exit; } + + if (!_PyArg_NoStackKeywords("spawnve", kwnames)) { + goto exit; + } return_value = os_spawnve_impl(module, mode, &path, argv, env); exit: @@ -1883,7 +1895,7 @@ os_sched_get_priority_max(PyObject *module, PyObject **args, Py_ssize_t nargs, P static _PyArg_Parser _parser = {"i:sched_get_priority_max", _keywords, 0}; int policy; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &policy)) { goto exit; } @@ -1917,7 +1929,7 @@ os_sched_get_priority_min(PyObject *module, PyObject **args, Py_ssize_t nargs, P static _PyArg_Parser _parser = {"i:sched_get_priority_min", _keywords, 0}; int policy; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &policy)) { goto exit; } @@ -2008,24 +2020,28 @@ PyDoc_STRVAR(os_sched_setscheduler__doc__, "param is an instance of sched_param."); #define OS_SCHED_SETSCHEDULER_METHODDEF \ - {"sched_setscheduler", (PyCFunction)os_sched_setscheduler, METH_VARARGS, os_sched_setscheduler__doc__}, + {"sched_setscheduler", (PyCFunction)os_sched_setscheduler, METH_FASTCALL, os_sched_setscheduler__doc__}, static PyObject * os_sched_setscheduler_impl(PyObject *module, pid_t pid, int policy, struct sched_param *param); static PyObject * -os_sched_setscheduler(PyObject *module, PyObject *args) +os_sched_setscheduler(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; pid_t pid; int policy; struct sched_param param; - if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "iO&:sched_setscheduler", + if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "iO&:sched_setscheduler", &pid, &policy, convert_sched_param, ¶m)) { goto exit; } + + if (!_PyArg_NoStackKeywords("sched_setscheduler", kwnames)) { + goto exit; + } return_value = os_sched_setscheduler_impl(module, pid, policy, ¶m); exit: @@ -2080,23 +2096,27 @@ PyDoc_STRVAR(os_sched_setparam__doc__, "param should be an instance of sched_param."); #define OS_SCHED_SETPARAM_METHODDEF \ - {"sched_setparam", (PyCFunction)os_sched_setparam, METH_VARARGS, os_sched_setparam__doc__}, + {"sched_setparam", (PyCFunction)os_sched_setparam, METH_FASTCALL, os_sched_setparam__doc__}, static PyObject * os_sched_setparam_impl(PyObject *module, pid_t pid, struct sched_param *param); static PyObject * -os_sched_setparam(PyObject *module, PyObject *args) +os_sched_setparam(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; pid_t pid; struct sched_param param; - if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "O&:sched_setparam", + if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "O&:sched_setparam", &pid, convert_sched_param, ¶m)) { goto exit; } + + if (!_PyArg_NoStackKeywords("sched_setparam", kwnames)) { + goto exit; + } return_value = os_sched_setparam_impl(module, pid, ¶m); exit: @@ -2176,22 +2196,26 @@ PyDoc_STRVAR(os_sched_setaffinity__doc__, "mask should be an iterable of integers identifying CPUs."); #define OS_SCHED_SETAFFINITY_METHODDEF \ - {"sched_setaffinity", (PyCFunction)os_sched_setaffinity, METH_VARARGS, os_sched_setaffinity__doc__}, + {"sched_setaffinity", (PyCFunction)os_sched_setaffinity, METH_FASTCALL, os_sched_setaffinity__doc__}, static PyObject * os_sched_setaffinity_impl(PyObject *module, pid_t pid, PyObject *mask); static PyObject * -os_sched_setaffinity(PyObject *module, PyObject *args) +os_sched_setaffinity(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; pid_t pid; PyObject *mask; - if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "O:sched_setaffinity", + if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "O:sched_setaffinity", &pid, &mask)) { goto exit; } + + if (!_PyArg_NoStackKeywords("sched_setaffinity", kwnames)) { + goto exit; + } return_value = os_sched_setaffinity_impl(module, pid, mask); exit: @@ -2417,7 +2441,7 @@ os_getpgid(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwname static _PyArg_Parser _parser = {"" _Py_PARSE_PID ":getpgid", _keywords, 0}; pid_t pid; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &pid)) { goto exit; } @@ -2551,22 +2575,26 @@ PyDoc_STRVAR(os_kill__doc__, "Kill a process with a signal."); #define OS_KILL_METHODDEF \ - {"kill", (PyCFunction)os_kill, METH_VARARGS, os_kill__doc__}, + {"kill", (PyCFunction)os_kill, METH_FASTCALL, os_kill__doc__}, static PyObject * os_kill_impl(PyObject *module, pid_t pid, Py_ssize_t signal); static PyObject * -os_kill(PyObject *module, PyObject *args) +os_kill(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; pid_t pid; Py_ssize_t signal; - if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "n:kill", + if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "n:kill", &pid, &signal)) { goto exit; } + + if (!_PyArg_NoStackKeywords("kill", kwnames)) { + goto exit; + } return_value = os_kill_impl(module, pid, signal); exit: @@ -2584,22 +2612,26 @@ PyDoc_STRVAR(os_killpg__doc__, "Kill a process group with a signal."); #define OS_KILLPG_METHODDEF \ - {"killpg", (PyCFunction)os_killpg, METH_VARARGS, os_killpg__doc__}, + {"killpg", (PyCFunction)os_killpg, METH_FASTCALL, os_killpg__doc__}, static PyObject * os_killpg_impl(PyObject *module, pid_t pgid, int signal); static PyObject * -os_killpg(PyObject *module, PyObject *args) +os_killpg(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; pid_t pgid; int signal; - if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "i:killpg", + if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "i:killpg", &pgid, &signal)) { goto exit; } + + if (!_PyArg_NoStackKeywords("killpg", kwnames)) { + goto exit; + } return_value = os_killpg_impl(module, pgid, signal); exit: @@ -2741,22 +2773,26 @@ PyDoc_STRVAR(os_setreuid__doc__, "Set the current process\'s real and effective user ids."); #define OS_SETREUID_METHODDEF \ - {"setreuid", (PyCFunction)os_setreuid, METH_VARARGS, os_setreuid__doc__}, + {"setreuid", (PyCFunction)os_setreuid, METH_FASTCALL, os_setreuid__doc__}, static PyObject * os_setreuid_impl(PyObject *module, uid_t ruid, uid_t euid); static PyObject * -os_setreuid(PyObject *module, PyObject *args) +os_setreuid(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; uid_t ruid; uid_t euid; - if (!PyArg_ParseTuple(args, "O&O&:setreuid", + if (!_PyArg_ParseStack(args, nargs, "O&O&:setreuid", _Py_Uid_Converter, &ruid, _Py_Uid_Converter, &euid)) { goto exit; } + + if (!_PyArg_NoStackKeywords("setreuid", kwnames)) { + goto exit; + } return_value = os_setreuid_impl(module, ruid, euid); exit: @@ -2774,22 +2810,26 @@ PyDoc_STRVAR(os_setregid__doc__, "Set the current process\'s real and effective group ids."); #define OS_SETREGID_METHODDEF \ - {"setregid", (PyCFunction)os_setregid, METH_VARARGS, os_setregid__doc__}, + {"setregid", (PyCFunction)os_setregid, METH_FASTCALL, os_setregid__doc__}, static PyObject * os_setregid_impl(PyObject *module, gid_t rgid, gid_t egid); static PyObject * -os_setregid(PyObject *module, PyObject *args) +os_setregid(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; gid_t rgid; gid_t egid; - if (!PyArg_ParseTuple(args, "O&O&:setregid", + if (!_PyArg_ParseStack(args, nargs, "O&O&:setregid", _Py_Gid_Converter, &rgid, _Py_Gid_Converter, &egid)) { goto exit; } + + if (!_PyArg_NoStackKeywords("setregid", kwnames)) { + goto exit; + } return_value = os_setregid_impl(module, rgid, egid); exit: @@ -2867,7 +2907,7 @@ os_wait3(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) static _PyArg_Parser _parser = {"i:wait3", _keywords, 0}; int options; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &options)) { goto exit; } @@ -2905,7 +2945,7 @@ os_wait4(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) pid_t pid; int options; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &pid, &options)) { goto exit; } @@ -2937,23 +2977,27 @@ PyDoc_STRVAR(os_waitid__doc__, "no children in a waitable state."); #define OS_WAITID_METHODDEF \ - {"waitid", (PyCFunction)os_waitid, METH_VARARGS, os_waitid__doc__}, + {"waitid", (PyCFunction)os_waitid, METH_FASTCALL, os_waitid__doc__}, static PyObject * os_waitid_impl(PyObject *module, idtype_t idtype, id_t id, int options); static PyObject * -os_waitid(PyObject *module, PyObject *args) +os_waitid(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; idtype_t idtype; id_t id; int options; - if (!PyArg_ParseTuple(args, "i" _Py_PARSE_PID "i:waitid", + if (!_PyArg_ParseStack(args, nargs, "i" _Py_PARSE_PID "i:waitid", &idtype, &id, &options)) { goto exit; } + + if (!_PyArg_NoStackKeywords("waitid", kwnames)) { + goto exit; + } return_value = os_waitid_impl(module, idtype, id, options); exit: @@ -2976,22 +3020,26 @@ PyDoc_STRVAR(os_waitpid__doc__, "The options argument is ignored on Windows."); #define OS_WAITPID_METHODDEF \ - {"waitpid", (PyCFunction)os_waitpid, METH_VARARGS, os_waitpid__doc__}, + {"waitpid", (PyCFunction)os_waitpid, METH_FASTCALL, os_waitpid__doc__}, static PyObject * os_waitpid_impl(PyObject *module, pid_t pid, int options); static PyObject * -os_waitpid(PyObject *module, PyObject *args) +os_waitpid(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; pid_t pid; int options; - if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "i:waitpid", + if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "i:waitpid", &pid, &options)) { goto exit; } + + if (!_PyArg_NoStackKeywords("waitpid", kwnames)) { + goto exit; + } return_value = os_waitpid_impl(module, pid, options); exit: @@ -3014,22 +3062,26 @@ PyDoc_STRVAR(os_waitpid__doc__, "The options argument is ignored on Windows."); #define OS_WAITPID_METHODDEF \ - {"waitpid", (PyCFunction)os_waitpid, METH_VARARGS, os_waitpid__doc__}, + {"waitpid", (PyCFunction)os_waitpid, METH_FASTCALL, os_waitpid__doc__}, static PyObject * os_waitpid_impl(PyObject *module, intptr_t pid, int options); static PyObject * -os_waitpid(PyObject *module, PyObject *args) +os_waitpid(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; intptr_t pid; int options; - if (!PyArg_ParseTuple(args, "" _Py_PARSE_INTPTR "i:waitpid", + if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_INTPTR "i:waitpid", &pid, &options)) { goto exit; } + + if (!_PyArg_NoStackKeywords("waitpid", kwnames)) { + goto exit; + } return_value = os_waitpid_impl(module, pid, options); exit: @@ -3099,7 +3151,7 @@ os_symlink(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwname int target_is_directory = 0; int dir_fd = DEFAULT_DIR_FD; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &src, path_converter, &dst, &target_is_directory, SYMLINKAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; } @@ -3204,22 +3256,26 @@ PyDoc_STRVAR(os_setpgid__doc__, "Call the system call setpgid(pid, pgrp)."); #define OS_SETPGID_METHODDEF \ - {"setpgid", (PyCFunction)os_setpgid, METH_VARARGS, os_setpgid__doc__}, + {"setpgid", (PyCFunction)os_setpgid, METH_FASTCALL, os_setpgid__doc__}, static PyObject * os_setpgid_impl(PyObject *module, pid_t pid, pid_t pgrp); static PyObject * -os_setpgid(PyObject *module, PyObject *args) +os_setpgid(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; pid_t pid; pid_t pgrp; - if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "" _Py_PARSE_PID ":setpgid", + if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "" _Py_PARSE_PID ":setpgid", &pid, &pgrp)) { goto exit; } + + if (!_PyArg_NoStackKeywords("setpgid", kwnames)) { + goto exit; + } return_value = os_setpgid_impl(module, pid, pgrp); exit: @@ -3268,22 +3324,26 @@ PyDoc_STRVAR(os_tcsetpgrp__doc__, "Set the process group associated with the terminal specified by fd."); #define OS_TCSETPGRP_METHODDEF \ - {"tcsetpgrp", (PyCFunction)os_tcsetpgrp, METH_VARARGS, os_tcsetpgrp__doc__}, + {"tcsetpgrp", (PyCFunction)os_tcsetpgrp, METH_FASTCALL, os_tcsetpgrp__doc__}, static PyObject * os_tcsetpgrp_impl(PyObject *module, int fd, pid_t pgid); static PyObject * -os_tcsetpgrp(PyObject *module, PyObject *args) +os_tcsetpgrp(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; pid_t pgid; - if (!PyArg_ParseTuple(args, "i" _Py_PARSE_PID ":tcsetpgrp", + if (!_PyArg_ParseStack(args, nargs, "i" _Py_PARSE_PID ":tcsetpgrp", &fd, &pgid)) { goto exit; } + + if (!_PyArg_NoStackKeywords("tcsetpgrp", kwnames)) { + goto exit; + } return_value = os_tcsetpgrp_impl(module, fd, pgid); exit: @@ -3321,7 +3381,7 @@ os_open(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) int dir_fd = DEFAULT_DIR_FD; int _return_value; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, &flags, &mode, OPENAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; } @@ -3358,7 +3418,7 @@ os_close(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) static _PyArg_Parser _parser = {"i:close", _keywords, 0}; int fd; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &fd)) { goto exit; } @@ -3375,22 +3435,26 @@ PyDoc_STRVAR(os_closerange__doc__, "Closes all file descriptors in [fd_low, fd_high), ignoring errors."); #define OS_CLOSERANGE_METHODDEF \ - {"closerange", (PyCFunction)os_closerange, METH_VARARGS, os_closerange__doc__}, + {"closerange", (PyCFunction)os_closerange, METH_FASTCALL, os_closerange__doc__}, static PyObject * os_closerange_impl(PyObject *module, int fd_low, int fd_high); static PyObject * -os_closerange(PyObject *module, PyObject *args) +os_closerange(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd_low; int fd_high; - if (!PyArg_ParseTuple(args, "ii:closerange", + if (!_PyArg_ParseStack(args, nargs, "ii:closerange", &fd_low, &fd_high)) { goto exit; } + + if (!_PyArg_NoStackKeywords("closerange", kwnames)) { + goto exit; + } return_value = os_closerange_impl(module, fd_low, fd_high); exit: @@ -3451,7 +3515,7 @@ os_dup2(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) int fd2; int inheritable = 1; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &fd, &fd2, &inheritable)) { goto exit; } @@ -3477,23 +3541,27 @@ PyDoc_STRVAR(os_lockf__doc__, " The number of bytes to lock, starting at the current position."); #define OS_LOCKF_METHODDEF \ - {"lockf", (PyCFunction)os_lockf, METH_VARARGS, os_lockf__doc__}, + {"lockf", (PyCFunction)os_lockf, METH_FASTCALL, os_lockf__doc__}, static PyObject * os_lockf_impl(PyObject *module, int fd, int command, Py_off_t length); static PyObject * -os_lockf(PyObject *module, PyObject *args) +os_lockf(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; int command; Py_off_t length; - if (!PyArg_ParseTuple(args, "iiO&:lockf", + if (!_PyArg_ParseStack(args, nargs, "iiO&:lockf", &fd, &command, Py_off_t_converter, &length)) { goto exit; } + + if (!_PyArg_NoStackKeywords("lockf", kwnames)) { + goto exit; + } return_value = os_lockf_impl(module, fd, command, length); exit: @@ -3512,13 +3580,13 @@ PyDoc_STRVAR(os_lseek__doc__, "relative to the beginning of the file."); #define OS_LSEEK_METHODDEF \ - {"lseek", (PyCFunction)os_lseek, METH_VARARGS, os_lseek__doc__}, + {"lseek", (PyCFunction)os_lseek, METH_FASTCALL, os_lseek__doc__}, static Py_off_t os_lseek_impl(PyObject *module, int fd, Py_off_t position, int how); static PyObject * -os_lseek(PyObject *module, PyObject *args) +os_lseek(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; @@ -3526,10 +3594,14 @@ os_lseek(PyObject *module, PyObject *args) int how; Py_off_t _return_value; - if (!PyArg_ParseTuple(args, "iO&i:lseek", + if (!_PyArg_ParseStack(args, nargs, "iO&i:lseek", &fd, Py_off_t_converter, &position, &how)) { goto exit; } + + if (!_PyArg_NoStackKeywords("lseek", kwnames)) { + goto exit; + } _return_value = os_lseek_impl(module, fd, position, how); if ((_return_value == -1) && PyErr_Occurred()) { goto exit; @@ -3547,22 +3619,26 @@ PyDoc_STRVAR(os_read__doc__, "Read from a file descriptor. Returns a bytes object."); #define OS_READ_METHODDEF \ - {"read", (PyCFunction)os_read, METH_VARARGS, os_read__doc__}, + {"read", (PyCFunction)os_read, METH_FASTCALL, os_read__doc__}, static PyObject * os_read_impl(PyObject *module, int fd, Py_ssize_t length); static PyObject * -os_read(PyObject *module, PyObject *args) +os_read(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; Py_ssize_t length; - if (!PyArg_ParseTuple(args, "in:read", + if (!_PyArg_ParseStack(args, nargs, "in:read", &fd, &length)) { goto exit; } + + if (!_PyArg_NoStackKeywords("read", kwnames)) { + goto exit; + } return_value = os_read_impl(module, fd, length); exit: @@ -3586,23 +3662,27 @@ PyDoc_STRVAR(os_readv__doc__, "which may be less than the total capacity of all the buffers."); #define OS_READV_METHODDEF \ - {"readv", (PyCFunction)os_readv, METH_VARARGS, os_readv__doc__}, + {"readv", (PyCFunction)os_readv, METH_FASTCALL, os_readv__doc__}, static Py_ssize_t os_readv_impl(PyObject *module, int fd, PyObject *buffers); static PyObject * -os_readv(PyObject *module, PyObject *args) +os_readv(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; PyObject *buffers; Py_ssize_t _return_value; - if (!PyArg_ParseTuple(args, "iO:readv", + if (!_PyArg_ParseStack(args, nargs, "iO:readv", &fd, &buffers)) { goto exit; } + + if (!_PyArg_NoStackKeywords("readv", kwnames)) { + goto exit; + } _return_value = os_readv_impl(module, fd, buffers); if ((_return_value == -1) && PyErr_Occurred()) { goto exit; @@ -3627,23 +3707,27 @@ PyDoc_STRVAR(os_pread__doc__, "the beginning of the file. The file offset remains unchanged."); #define OS_PREAD_METHODDEF \ - {"pread", (PyCFunction)os_pread, METH_VARARGS, os_pread__doc__}, + {"pread", (PyCFunction)os_pread, METH_FASTCALL, os_pread__doc__}, static PyObject * os_pread_impl(PyObject *module, int fd, int length, Py_off_t offset); static PyObject * -os_pread(PyObject *module, PyObject *args) +os_pread(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; int length; Py_off_t offset; - if (!PyArg_ParseTuple(args, "iiO&:pread", + if (!_PyArg_ParseStack(args, nargs, "iiO&:pread", &fd, &length, Py_off_t_converter, &offset)) { goto exit; } + + if (!_PyArg_NoStackKeywords("pread", kwnames)) { + goto exit; + } return_value = os_pread_impl(module, fd, length, offset); exit: @@ -3659,23 +3743,27 @@ PyDoc_STRVAR(os_write__doc__, "Write a bytes object to a file descriptor."); #define OS_WRITE_METHODDEF \ - {"write", (PyCFunction)os_write, METH_VARARGS, os_write__doc__}, + {"write", (PyCFunction)os_write, METH_FASTCALL, os_write__doc__}, static Py_ssize_t os_write_impl(PyObject *module, int fd, Py_buffer *data); static PyObject * -os_write(PyObject *module, PyObject *args) +os_write(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; Py_buffer data = {NULL, NULL}; Py_ssize_t _return_value; - if (!PyArg_ParseTuple(args, "iy*:write", + if (!_PyArg_ParseStack(args, nargs, "iy*:write", &fd, &data)) { goto exit; } + + if (!_PyArg_NoStackKeywords("write", kwnames)) { + goto exit; + } _return_value = os_write_impl(module, fd, &data); if ((_return_value == -1) && PyErr_Occurred()) { goto exit; @@ -3714,7 +3802,7 @@ os_fstat(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) static _PyArg_Parser _parser = {"i:fstat", _keywords, 0}; int fd; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &fd)) { goto exit; } @@ -3833,23 +3921,27 @@ PyDoc_STRVAR(os_writev__doc__, "buffers must be a sequence of bytes-like objects."); #define OS_WRITEV_METHODDEF \ - {"writev", (PyCFunction)os_writev, METH_VARARGS, os_writev__doc__}, + {"writev", (PyCFunction)os_writev, METH_FASTCALL, os_writev__doc__}, static Py_ssize_t os_writev_impl(PyObject *module, int fd, PyObject *buffers); static PyObject * -os_writev(PyObject *module, PyObject *args) +os_writev(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; PyObject *buffers; Py_ssize_t _return_value; - if (!PyArg_ParseTuple(args, "iO:writev", + if (!_PyArg_ParseStack(args, nargs, "iO:writev", &fd, &buffers)) { goto exit; } + + if (!_PyArg_NoStackKeywords("writev", kwnames)) { + goto exit; + } _return_value = os_writev_impl(module, fd, buffers); if ((_return_value == -1) && PyErr_Occurred()) { goto exit; @@ -3875,13 +3967,13 @@ PyDoc_STRVAR(os_pwrite__doc__, "current file offset."); #define OS_PWRITE_METHODDEF \ - {"pwrite", (PyCFunction)os_pwrite, METH_VARARGS, os_pwrite__doc__}, + {"pwrite", (PyCFunction)os_pwrite, METH_FASTCALL, os_pwrite__doc__}, static Py_ssize_t os_pwrite_impl(PyObject *module, int fd, Py_buffer *buffer, Py_off_t offset); static PyObject * -os_pwrite(PyObject *module, PyObject *args) +os_pwrite(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; @@ -3889,10 +3981,14 @@ os_pwrite(PyObject *module, PyObject *args) Py_off_t offset; Py_ssize_t _return_value; - if (!PyArg_ParseTuple(args, "iy*O&:pwrite", + if (!_PyArg_ParseStack(args, nargs, "iy*O&:pwrite", &fd, &buffer, Py_off_t_converter, &offset)) { goto exit; } + + if (!_PyArg_NoStackKeywords("pwrite", kwnames)) { + goto exit; + } _return_value = os_pwrite_impl(module, fd, &buffer, offset); if ((_return_value == -1) && PyErr_Occurred()) { goto exit; @@ -3939,7 +4035,7 @@ os_mkfifo(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames int mode = 438; int dir_fd = DEFAULT_DIR_FD; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, &mode, MKFIFOAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; } @@ -3992,7 +4088,7 @@ os_mknod(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) dev_t device = 0; int dir_fd = DEFAULT_DIR_FD; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, &mode, _Py_Dev_Converter, &device, MKNODAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; } @@ -4088,23 +4184,27 @@ PyDoc_STRVAR(os_makedev__doc__, "Composes a raw device number from the major and minor device numbers."); #define OS_MAKEDEV_METHODDEF \ - {"makedev", (PyCFunction)os_makedev, METH_VARARGS, os_makedev__doc__}, + {"makedev", (PyCFunction)os_makedev, METH_FASTCALL, os_makedev__doc__}, static dev_t os_makedev_impl(PyObject *module, int major, int minor); static PyObject * -os_makedev(PyObject *module, PyObject *args) +os_makedev(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int major; int minor; dev_t _return_value; - if (!PyArg_ParseTuple(args, "ii:makedev", + if (!_PyArg_ParseStack(args, nargs, "ii:makedev", &major, &minor)) { goto exit; } + + if (!_PyArg_NoStackKeywords("makedev", kwnames)) { + goto exit; + } _return_value = os_makedev_impl(module, major, minor); if ((_return_value == (dev_t)-1) && PyErr_Occurred()) { goto exit; @@ -4126,22 +4226,26 @@ PyDoc_STRVAR(os_ftruncate__doc__, "Truncate a file, specified by file descriptor, to a specific length."); #define OS_FTRUNCATE_METHODDEF \ - {"ftruncate", (PyCFunction)os_ftruncate, METH_VARARGS, os_ftruncate__doc__}, + {"ftruncate", (PyCFunction)os_ftruncate, METH_FASTCALL, os_ftruncate__doc__}, static PyObject * os_ftruncate_impl(PyObject *module, int fd, Py_off_t length); static PyObject * -os_ftruncate(PyObject *module, PyObject *args) +os_ftruncate(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; Py_off_t length; - if (!PyArg_ParseTuple(args, "iO&:ftruncate", + if (!_PyArg_ParseStack(args, nargs, "iO&:ftruncate", &fd, Py_off_t_converter, &length)) { goto exit; } + + if (!_PyArg_NoStackKeywords("ftruncate", kwnames)) { + goto exit; + } return_value = os_ftruncate_impl(module, fd, length); exit: @@ -4176,7 +4280,7 @@ os_truncate(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnam path_t path = PATH_T_INITIALIZE("truncate", "path", 0, PATH_HAVE_FTRUNCATE); Py_off_t length; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, Py_off_t_converter, &length)) { goto exit; } @@ -4203,24 +4307,28 @@ PyDoc_STRVAR(os_posix_fallocate__doc__, "starting at offset bytes from the beginning and continuing for length bytes."); #define OS_POSIX_FALLOCATE_METHODDEF \ - {"posix_fallocate", (PyCFunction)os_posix_fallocate, METH_VARARGS, os_posix_fallocate__doc__}, + {"posix_fallocate", (PyCFunction)os_posix_fallocate, METH_FASTCALL, os_posix_fallocate__doc__}, static PyObject * os_posix_fallocate_impl(PyObject *module, int fd, Py_off_t offset, Py_off_t length); static PyObject * -os_posix_fallocate(PyObject *module, PyObject *args) +os_posix_fallocate(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; Py_off_t offset; Py_off_t length; - if (!PyArg_ParseTuple(args, "iO&O&:posix_fallocate", + if (!_PyArg_ParseStack(args, nargs, "iO&O&:posix_fallocate", &fd, Py_off_t_converter, &offset, Py_off_t_converter, &length)) { goto exit; } + + if (!_PyArg_NoStackKeywords("posix_fallocate", kwnames)) { + goto exit; + } return_value = os_posix_fallocate_impl(module, fd, offset, length); exit: @@ -4246,14 +4354,14 @@ PyDoc_STRVAR(os_posix_fadvise__doc__, "POSIX_FADV_DONTNEED."); #define OS_POSIX_FADVISE_METHODDEF \ - {"posix_fadvise", (PyCFunction)os_posix_fadvise, METH_VARARGS, os_posix_fadvise__doc__}, + {"posix_fadvise", (PyCFunction)os_posix_fadvise, METH_FASTCALL, os_posix_fadvise__doc__}, static PyObject * os_posix_fadvise_impl(PyObject *module, int fd, Py_off_t offset, Py_off_t length, int advice); static PyObject * -os_posix_fadvise(PyObject *module, PyObject *args) +os_posix_fadvise(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; @@ -4261,10 +4369,14 @@ os_posix_fadvise(PyObject *module, PyObject *args) Py_off_t length; int advice; - if (!PyArg_ParseTuple(args, "iO&O&i:posix_fadvise", + if (!_PyArg_ParseStack(args, nargs, "iO&O&i:posix_fadvise", &fd, Py_off_t_converter, &offset, Py_off_t_converter, &length, &advice)) { goto exit; } + + if (!_PyArg_NoStackKeywords("posix_fadvise", kwnames)) { + goto exit; + } return_value = os_posix_fadvise_impl(module, fd, offset, length, advice); exit: @@ -4282,22 +4394,26 @@ PyDoc_STRVAR(os_putenv__doc__, "Change or add an environment variable."); #define OS_PUTENV_METHODDEF \ - {"putenv", (PyCFunction)os_putenv, METH_VARARGS, os_putenv__doc__}, + {"putenv", (PyCFunction)os_putenv, METH_FASTCALL, os_putenv__doc__}, static PyObject * os_putenv_impl(PyObject *module, PyObject *name, PyObject *value); static PyObject * -os_putenv(PyObject *module, PyObject *args) +os_putenv(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *name; PyObject *value; - if (!PyArg_ParseTuple(args, "UU:putenv", + if (!_PyArg_ParseStack(args, nargs, "UU:putenv", &name, &value)) { goto exit; } + + if (!_PyArg_NoStackKeywords("putenv", kwnames)) { + goto exit; + } return_value = os_putenv_impl(module, name, value); exit: @@ -4315,22 +4431,26 @@ PyDoc_STRVAR(os_putenv__doc__, "Change or add an environment variable."); #define OS_PUTENV_METHODDEF \ - {"putenv", (PyCFunction)os_putenv, METH_VARARGS, os_putenv__doc__}, + {"putenv", (PyCFunction)os_putenv, METH_FASTCALL, os_putenv__doc__}, static PyObject * os_putenv_impl(PyObject *module, PyObject *name, PyObject *value); static PyObject * -os_putenv(PyObject *module, PyObject *args) +os_putenv(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *name = NULL; PyObject *value = NULL; - if (!PyArg_ParseTuple(args, "O&O&:putenv", + if (!_PyArg_ParseStack(args, nargs, "O&O&:putenv", PyUnicode_FSConverter, &name, PyUnicode_FSConverter, &value)) { goto exit; } + + if (!_PyArg_NoStackKeywords("putenv", kwnames)) { + goto exit; + } return_value = os_putenv_impl(module, name, value); exit: @@ -4467,7 +4587,7 @@ os_WIFCONTINUED(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *k int status; int _return_value; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &status)) { goto exit; } @@ -4506,7 +4626,7 @@ os_WIFSTOPPED(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwn int status; int _return_value; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &status)) { goto exit; } @@ -4545,7 +4665,7 @@ os_WIFSIGNALED(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kw int status; int _return_value; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &status)) { goto exit; } @@ -4584,7 +4704,7 @@ os_WIFEXITED(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwna int status; int _return_value; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &status)) { goto exit; } @@ -4623,7 +4743,7 @@ os_WEXITSTATUS(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kw int status; int _return_value; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &status)) { goto exit; } @@ -4662,7 +4782,7 @@ os_WTERMSIG(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnam int status; int _return_value; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &status)) { goto exit; } @@ -4701,7 +4821,7 @@ os_WSTOPSIG(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnam int status; int _return_value; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &status)) { goto exit; } @@ -4776,7 +4896,7 @@ os_statvfs(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwname static _PyArg_Parser _parser = {"O&:statvfs", _keywords, 0}; path_t path = PATH_T_INITIALIZE("statvfs", "path", 0, PATH_HAVE_FSTATVFS); - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path)) { goto exit; } @@ -4813,7 +4933,7 @@ os__getdiskusage(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject * static _PyArg_Parser _parser = {"u:_getdiskusage", _keywords, 0}; Py_UNICODE *path; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &path)) { goto exit; } @@ -4836,23 +4956,27 @@ PyDoc_STRVAR(os_fpathconf__doc__, "If there is no limit, return -1."); #define OS_FPATHCONF_METHODDEF \ - {"fpathconf", (PyCFunction)os_fpathconf, METH_VARARGS, os_fpathconf__doc__}, + {"fpathconf", (PyCFunction)os_fpathconf, METH_FASTCALL, os_fpathconf__doc__}, static long os_fpathconf_impl(PyObject *module, int fd, int name); static PyObject * -os_fpathconf(PyObject *module, PyObject *args) +os_fpathconf(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; int name; long _return_value; - if (!PyArg_ParseTuple(args, "iO&:fpathconf", + if (!_PyArg_ParseStack(args, nargs, "iO&:fpathconf", &fd, conv_path_confname, &name)) { goto exit; } + + if (!_PyArg_NoStackKeywords("fpathconf", kwnames)) { + goto exit; + } _return_value = os_fpathconf_impl(module, fd, name); if ((_return_value == -1) && PyErr_Occurred()) { goto exit; @@ -4893,7 +5017,7 @@ os_pathconf(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnam int name; long _return_value; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, conv_path_confname, &name)) { goto exit; } @@ -5040,7 +5164,7 @@ os_startfile(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwna path_t filepath = PATH_T_INITIALIZE("startfile", "filepath", 0, 0); Py_UNICODE *operation = NULL; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &filepath, &operation)) { goto exit; } @@ -5104,7 +5228,7 @@ os_device_encoding(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject static _PyArg_Parser _parser = {"i:device_encoding", _keywords, 0}; int fd; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &fd)) { goto exit; } @@ -5123,23 +5247,27 @@ PyDoc_STRVAR(os_setresuid__doc__, "Set the current process\'s real, effective, and saved user ids."); #define OS_SETRESUID_METHODDEF \ - {"setresuid", (PyCFunction)os_setresuid, METH_VARARGS, os_setresuid__doc__}, + {"setresuid", (PyCFunction)os_setresuid, METH_FASTCALL, os_setresuid__doc__}, static PyObject * os_setresuid_impl(PyObject *module, uid_t ruid, uid_t euid, uid_t suid); static PyObject * -os_setresuid(PyObject *module, PyObject *args) +os_setresuid(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; uid_t ruid; uid_t euid; uid_t suid; - if (!PyArg_ParseTuple(args, "O&O&O&:setresuid", + if (!_PyArg_ParseStack(args, nargs, "O&O&O&:setresuid", _Py_Uid_Converter, &ruid, _Py_Uid_Converter, &euid, _Py_Uid_Converter, &suid)) { goto exit; } + + if (!_PyArg_NoStackKeywords("setresuid", kwnames)) { + goto exit; + } return_value = os_setresuid_impl(module, ruid, euid, suid); exit: @@ -5157,23 +5285,27 @@ PyDoc_STRVAR(os_setresgid__doc__, "Set the current process\'s real, effective, and saved group ids."); #define OS_SETRESGID_METHODDEF \ - {"setresgid", (PyCFunction)os_setresgid, METH_VARARGS, os_setresgid__doc__}, + {"setresgid", (PyCFunction)os_setresgid, METH_FASTCALL, os_setresgid__doc__}, static PyObject * os_setresgid_impl(PyObject *module, gid_t rgid, gid_t egid, gid_t sgid); static PyObject * -os_setresgid(PyObject *module, PyObject *args) +os_setresgid(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; gid_t rgid; gid_t egid; gid_t sgid; - if (!PyArg_ParseTuple(args, "O&O&O&:setresgid", + if (!_PyArg_ParseStack(args, nargs, "O&O&O&:setresgid", _Py_Gid_Converter, &rgid, _Py_Gid_Converter, &egid, _Py_Gid_Converter, &sgid)) { goto exit; } + + if (!_PyArg_NoStackKeywords("setresgid", kwnames)) { + goto exit; + } return_value = os_setresgid_impl(module, rgid, egid, sgid); exit: @@ -5256,7 +5388,7 @@ os_getxattr(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnam path_t attribute = PATH_T_INITIALIZE("getxattr", "attribute", 0, 0); int follow_symlinks = 1; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, path_converter, &attribute, &follow_symlinks)) { goto exit; } @@ -5306,7 +5438,7 @@ os_setxattr(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnam int flags = 0; int follow_symlinks = 1; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, path_converter, &attribute, &value, &flags, &follow_symlinks)) { goto exit; } @@ -5357,7 +5489,7 @@ os_removexattr(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kw path_t attribute = PATH_T_INITIALIZE("removexattr", "attribute", 0, 0); int follow_symlinks = 1; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, path_converter, &attribute, &follow_symlinks)) { goto exit; } @@ -5403,7 +5535,7 @@ os_listxattr(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwna path_t path = PATH_T_INITIALIZE("listxattr", "path", 1, 1); int follow_symlinks = 1; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, path_converter, &path, &follow_symlinks)) { goto exit; } @@ -5506,22 +5638,26 @@ PyDoc_STRVAR(os_set_inheritable__doc__, "Set the inheritable flag of the specified file descriptor."); #define OS_SET_INHERITABLE_METHODDEF \ - {"set_inheritable", (PyCFunction)os_set_inheritable, METH_VARARGS, os_set_inheritable__doc__}, + {"set_inheritable", (PyCFunction)os_set_inheritable, METH_FASTCALL, os_set_inheritable__doc__}, static PyObject * os_set_inheritable_impl(PyObject *module, int fd, int inheritable); static PyObject * -os_set_inheritable(PyObject *module, PyObject *args) +os_set_inheritable(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int fd; int inheritable; - if (!PyArg_ParseTuple(args, "ii:set_inheritable", + if (!_PyArg_ParseStack(args, nargs, "ii:set_inheritable", &fd, &inheritable)) { goto exit; } + + if (!_PyArg_NoStackKeywords("set_inheritable", kwnames)) { + goto exit; + } return_value = os_set_inheritable_impl(module, fd, inheritable); exit: @@ -5573,23 +5709,27 @@ PyDoc_STRVAR(os_set_handle_inheritable__doc__, "Set the inheritable flag of the specified handle."); #define OS_SET_HANDLE_INHERITABLE_METHODDEF \ - {"set_handle_inheritable", (PyCFunction)os_set_handle_inheritable, METH_VARARGS, os_set_handle_inheritable__doc__}, + {"set_handle_inheritable", (PyCFunction)os_set_handle_inheritable, METH_FASTCALL, os_set_handle_inheritable__doc__}, static PyObject * os_set_handle_inheritable_impl(PyObject *module, intptr_t handle, int inheritable); static PyObject * -os_set_handle_inheritable(PyObject *module, PyObject *args) +os_set_handle_inheritable(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; intptr_t handle; int inheritable; - if (!PyArg_ParseTuple(args, "" _Py_PARSE_INTPTR "p:set_handle_inheritable", + if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_INTPTR "p:set_handle_inheritable", &handle, &inheritable)) { goto exit; } + + if (!_PyArg_NoStackKeywords("set_handle_inheritable", kwnames)) { + goto exit; + } return_value = os_set_handle_inheritable_impl(module, handle, inheritable); exit: @@ -5598,6 +5738,209 @@ exit: #endif /* defined(MS_WINDOWS) */ +PyDoc_STRVAR(os_DirEntry_is_symlink__doc__, +"is_symlink($self, /)\n" +"--\n" +"\n" +"Return True if the entry is a symbolic link; cached per entry."); + +#define OS_DIRENTRY_IS_SYMLINK_METHODDEF \ + {"is_symlink", (PyCFunction)os_DirEntry_is_symlink, METH_NOARGS, os_DirEntry_is_symlink__doc__}, + +static int +os_DirEntry_is_symlink_impl(DirEntry *self); + +static PyObject * +os_DirEntry_is_symlink(DirEntry *self, PyObject *Py_UNUSED(ignored)) +{ + PyObject *return_value = NULL; + int _return_value; + + _return_value = os_DirEntry_is_symlink_impl(self); + if ((_return_value == -1) && PyErr_Occurred()) { + goto exit; + } + return_value = PyBool_FromLong((long)_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(os_DirEntry_stat__doc__, +"stat($self, /, *, follow_symlinks=True)\n" +"--\n" +"\n" +"Return stat_result object for the entry; cached per entry."); + +#define OS_DIRENTRY_STAT_METHODDEF \ + {"stat", (PyCFunction)os_DirEntry_stat, METH_FASTCALL, os_DirEntry_stat__doc__}, + +static PyObject * +os_DirEntry_stat_impl(DirEntry *self, int follow_symlinks); + +static PyObject * +os_DirEntry_stat(DirEntry *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + static const char * const _keywords[] = {"follow_symlinks", NULL}; + static _PyArg_Parser _parser = {"|$p:stat", _keywords, 0}; + int follow_symlinks = 1; + + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &follow_symlinks)) { + goto exit; + } + return_value = os_DirEntry_stat_impl(self, follow_symlinks); + +exit: + return return_value; +} + +PyDoc_STRVAR(os_DirEntry_is_dir__doc__, +"is_dir($self, /, *, follow_symlinks=True)\n" +"--\n" +"\n" +"Return True if the entry is a directory; cached per entry."); + +#define OS_DIRENTRY_IS_DIR_METHODDEF \ + {"is_dir", (PyCFunction)os_DirEntry_is_dir, METH_FASTCALL, os_DirEntry_is_dir__doc__}, + +static int +os_DirEntry_is_dir_impl(DirEntry *self, int follow_symlinks); + +static PyObject * +os_DirEntry_is_dir(DirEntry *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + static const char * const _keywords[] = {"follow_symlinks", NULL}; + static _PyArg_Parser _parser = {"|$p:is_dir", _keywords, 0}; + int follow_symlinks = 1; + int _return_value; + + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &follow_symlinks)) { + goto exit; + } + _return_value = os_DirEntry_is_dir_impl(self, follow_symlinks); + if ((_return_value == -1) && PyErr_Occurred()) { + goto exit; + } + return_value = PyBool_FromLong((long)_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(os_DirEntry_is_file__doc__, +"is_file($self, /, *, follow_symlinks=True)\n" +"--\n" +"\n" +"Return True if the entry is a file; cached per entry."); + +#define OS_DIRENTRY_IS_FILE_METHODDEF \ + {"is_file", (PyCFunction)os_DirEntry_is_file, METH_FASTCALL, os_DirEntry_is_file__doc__}, + +static int +os_DirEntry_is_file_impl(DirEntry *self, int follow_symlinks); + +static PyObject * +os_DirEntry_is_file(DirEntry *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + static const char * const _keywords[] = {"follow_symlinks", NULL}; + static _PyArg_Parser _parser = {"|$p:is_file", _keywords, 0}; + int follow_symlinks = 1; + int _return_value; + + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &follow_symlinks)) { + goto exit; + } + _return_value = os_DirEntry_is_file_impl(self, follow_symlinks); + if ((_return_value == -1) && PyErr_Occurred()) { + goto exit; + } + return_value = PyBool_FromLong((long)_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(os_DirEntry_inode__doc__, +"inode($self, /)\n" +"--\n" +"\n" +"Return inode of the entry; cached per entry."); + +#define OS_DIRENTRY_INODE_METHODDEF \ + {"inode", (PyCFunction)os_DirEntry_inode, METH_NOARGS, os_DirEntry_inode__doc__}, + +static PyObject * +os_DirEntry_inode_impl(DirEntry *self); + +static PyObject * +os_DirEntry_inode(DirEntry *self, PyObject *Py_UNUSED(ignored)) +{ + return os_DirEntry_inode_impl(self); +} + +PyDoc_STRVAR(os_DirEntry___fspath____doc__, +"__fspath__($self, /)\n" +"--\n" +"\n" +"Returns the path for the entry."); + +#define OS_DIRENTRY___FSPATH___METHODDEF \ + {"__fspath__", (PyCFunction)os_DirEntry___fspath__, METH_NOARGS, os_DirEntry___fspath____doc__}, + +static PyObject * +os_DirEntry___fspath___impl(DirEntry *self); + +static PyObject * +os_DirEntry___fspath__(DirEntry *self, PyObject *Py_UNUSED(ignored)) +{ + return os_DirEntry___fspath___impl(self); +} + +PyDoc_STRVAR(os_scandir__doc__, +"scandir($module, /, path=None)\n" +"--\n" +"\n" +"Return an iterator of DirEntry objects for given path.\n" +"\n" +"path can be specified as either str, bytes or path-like object. If path\n" +"is bytes, the names of yielded DirEntry objects will also be bytes; in\n" +"all other circumstances they will be str.\n" +"\n" +"If path is None, uses the path=\'.\'."); + +#define OS_SCANDIR_METHODDEF \ + {"scandir", (PyCFunction)os_scandir, METH_FASTCALL, os_scandir__doc__}, + +static PyObject * +os_scandir_impl(PyObject *module, path_t *path); + +static PyObject * +os_scandir(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + static const char * const _keywords[] = {"path", NULL}; + static _PyArg_Parser _parser = {"|O&:scandir", _keywords, 0}; + path_t path = PATH_T_INITIALIZE("scandir", "path", 1, 0); + + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + path_converter, &path)) { + goto exit; + } + return_value = os_scandir_impl(module, &path); + +exit: + /* Cleanup for path */ + path_cleanup(&path); + + return return_value; +} + PyDoc_STRVAR(os_fspath__doc__, "fspath($module, /, path)\n" "--\n" @@ -5622,7 +5965,7 @@ os_fspath(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames static _PyArg_Parser _parser = {"O:fspath", _keywords, 0}; PyObject *path; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &path)) { goto exit; } @@ -5655,7 +5998,7 @@ os_getrandom(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwna Py_ssize_t size; int flags = 0; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &size, &flags)) { goto exit; } @@ -6150,4 +6493,4 @@ exit: #ifndef OS_GETRANDOM_METHODDEF #define OS_GETRANDOM_METHODDEF #endif /* !defined(OS_GETRANDOM_METHODDEF) */ -/*[clinic end generated code: output=455def991740915a input=a9049054013a1b77]*/ +/*[clinic end generated code: output=5a0be969e3f71660 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/pyexpat.c.h b/Modules/clinic/pyexpat.c.h index 75a096cdff..eb6e337c2d 100644 --- a/Modules/clinic/pyexpat.c.h +++ b/Modules/clinic/pyexpat.c.h @@ -11,23 +11,27 @@ PyDoc_STRVAR(pyexpat_xmlparser_Parse__doc__, "`isfinal\' should be true at end of input."); #define PYEXPAT_XMLPARSER_PARSE_METHODDEF \ - {"Parse", (PyCFunction)pyexpat_xmlparser_Parse, METH_VARARGS, pyexpat_xmlparser_Parse__doc__}, + {"Parse", (PyCFunction)pyexpat_xmlparser_Parse, METH_FASTCALL, pyexpat_xmlparser_Parse__doc__}, static PyObject * pyexpat_xmlparser_Parse_impl(xmlparseobject *self, PyObject *data, int isfinal); static PyObject * -pyexpat_xmlparser_Parse(xmlparseobject *self, PyObject *args) +pyexpat_xmlparser_Parse(xmlparseobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *data; int isfinal = 0; - if (!PyArg_ParseTuple(args, "O|i:Parse", + if (!_PyArg_ParseStack(args, nargs, "O|i:Parse", &data, &isfinal)) { goto exit; } + + if (!_PyArg_NoStackKeywords("Parse", kwnames)) { + goto exit; + } return_value = pyexpat_xmlparser_Parse_impl(self, data, isfinal); exit: @@ -116,7 +120,7 @@ PyDoc_STRVAR(pyexpat_xmlparser_ExternalEntityParserCreate__doc__, "Create a parser for parsing an external entity based on the information passed to the ExternalEntityRefHandler."); #define PYEXPAT_XMLPARSER_EXTERNALENTITYPARSERCREATE_METHODDEF \ - {"ExternalEntityParserCreate", (PyCFunction)pyexpat_xmlparser_ExternalEntityParserCreate, METH_VARARGS, pyexpat_xmlparser_ExternalEntityParserCreate__doc__}, + {"ExternalEntityParserCreate", (PyCFunction)pyexpat_xmlparser_ExternalEntityParserCreate, METH_FASTCALL, pyexpat_xmlparser_ExternalEntityParserCreate__doc__}, static PyObject * pyexpat_xmlparser_ExternalEntityParserCreate_impl(xmlparseobject *self, @@ -124,16 +128,20 @@ pyexpat_xmlparser_ExternalEntityParserCreate_impl(xmlparseobject *self, const char *encoding); static PyObject * -pyexpat_xmlparser_ExternalEntityParserCreate(xmlparseobject *self, PyObject *args) +pyexpat_xmlparser_ExternalEntityParserCreate(xmlparseobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; const char *context; const char *encoding = NULL; - if (!PyArg_ParseTuple(args, "z|s:ExternalEntityParserCreate", + if (!_PyArg_ParseStack(args, nargs, "z|s:ExternalEntityParserCreate", &context, &encoding)) { goto exit; } + + if (!_PyArg_NoStackKeywords("ExternalEntityParserCreate", kwnames)) { + goto exit; + } return_value = pyexpat_xmlparser_ExternalEntityParserCreate_impl(self, context, encoding); exit: @@ -185,21 +193,25 @@ PyDoc_STRVAR(pyexpat_xmlparser_UseForeignDTD__doc__, "information to the parser. \'flag\' defaults to True if not provided."); #define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF \ - {"UseForeignDTD", (PyCFunction)pyexpat_xmlparser_UseForeignDTD, METH_VARARGS, pyexpat_xmlparser_UseForeignDTD__doc__}, + {"UseForeignDTD", (PyCFunction)pyexpat_xmlparser_UseForeignDTD, METH_FASTCALL, pyexpat_xmlparser_UseForeignDTD__doc__}, static PyObject * pyexpat_xmlparser_UseForeignDTD_impl(xmlparseobject *self, int flag); static PyObject * -pyexpat_xmlparser_UseForeignDTD(xmlparseobject *self, PyObject *args) +pyexpat_xmlparser_UseForeignDTD(xmlparseobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int flag = 1; - if (!PyArg_ParseTuple(args, "|p:UseForeignDTD", + if (!_PyArg_ParseStack(args, nargs, "|p:UseForeignDTD", &flag)) { goto exit; } + + if (!_PyArg_NoStackKeywords("UseForeignDTD", kwnames)) { + goto exit; + } return_value = pyexpat_xmlparser_UseForeignDTD_impl(self, flag); exit: @@ -249,7 +261,7 @@ pyexpat_ParserCreate(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObje const char *namespace_separator = NULL; PyObject *intern = NULL; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &encoding, &namespace_separator, &intern)) { goto exit; } @@ -289,4 +301,4 @@ exit: #ifndef PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF #define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF #endif /* !defined(PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF) */ -/*[clinic end generated code: output=e889f7c6af6cc42f input=a9049054013a1b77]*/ +/*[clinic end generated code: output=0548a6b12157e29b input=a9049054013a1b77]*/ diff --git a/Modules/clinic/sha1module.c.h b/Modules/clinic/sha1module.c.h index b08e92d099..e2f5ac16a3 100644 --- a/Modules/clinic/sha1module.c.h +++ b/Modules/clinic/sha1module.c.h @@ -85,7 +85,7 @@ _sha1_sha1(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwname static _PyArg_Parser _parser = {"|O:sha1", _keywords, 0}; PyObject *string = NULL; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &string)) { goto exit; } @@ -94,4 +94,4 @@ _sha1_sha1(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwname exit: return return_value; } -/*[clinic end generated code: output=1430450f3f806895 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=8e6b04c7e0407be2 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/sha256module.c.h b/Modules/clinic/sha256module.c.h index 115db500f4..e106e38da8 100644 --- a/Modules/clinic/sha256module.c.h +++ b/Modules/clinic/sha256module.c.h @@ -85,7 +85,7 @@ _sha256_sha256(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kw static _PyArg_Parser _parser = {"|O:sha256", _keywords, 0}; PyObject *string = NULL; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &string)) { goto exit; } @@ -115,7 +115,7 @@ _sha256_sha224(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kw static _PyArg_Parser _parser = {"|O:sha224", _keywords, 0}; PyObject *string = NULL; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &string)) { goto exit; } @@ -124,4 +124,4 @@ _sha256_sha224(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kw exit: return return_value; } -/*[clinic end generated code: output=19439d70db7ead5c input=a9049054013a1b77]*/ +/*[clinic end generated code: output=7ef4927ee2a3aac4 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/sha512module.c.h b/Modules/clinic/sha512module.c.h index a2b57f71b5..c91dfd27df 100644 --- a/Modules/clinic/sha512module.c.h +++ b/Modules/clinic/sha512module.c.h @@ -85,7 +85,7 @@ _sha512_sha512(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kw static _PyArg_Parser _parser = {"|O:sha512", _keywords, 0}; PyObject *string = NULL; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &string)) { goto exit; } @@ -115,7 +115,7 @@ _sha512_sha384(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kw static _PyArg_Parser _parser = {"|O:sha384", _keywords, 0}; PyObject *string = NULL; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &string)) { goto exit; } @@ -124,4 +124,4 @@ _sha512_sha384(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kw exit: return return_value; } -/*[clinic end generated code: output=18f15598c3487045 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=7bb7a49159e9b469 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/signalmodule.c.h b/Modules/clinic/signalmodule.c.h index f8d5bd942b..9e16f32291 100644 --- a/Modules/clinic/signalmodule.c.h +++ b/Modules/clinic/signalmodule.c.h @@ -74,22 +74,26 @@ PyDoc_STRVAR(signal_signal__doc__, "the first is the signal number, the second is the interrupted stack frame."); #define SIGNAL_SIGNAL_METHODDEF \ - {"signal", (PyCFunction)signal_signal, METH_VARARGS, signal_signal__doc__}, + {"signal", (PyCFunction)signal_signal, METH_FASTCALL, signal_signal__doc__}, static PyObject * signal_signal_impl(PyObject *module, int signalnum, PyObject *handler); static PyObject * -signal_signal(PyObject *module, PyObject *args) +signal_signal(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int signalnum; PyObject *handler; - if (!PyArg_ParseTuple(args, "iO:signal", + if (!_PyArg_ParseStack(args, nargs, "iO:signal", &signalnum, &handler)) { goto exit; } + + if (!_PyArg_NoStackKeywords("signal", kwnames)) { + goto exit; + } return_value = signal_signal_impl(module, signalnum, handler); exit: @@ -141,22 +145,26 @@ PyDoc_STRVAR(signal_siginterrupt__doc__, "signal sig, else system calls will be interrupted."); #define SIGNAL_SIGINTERRUPT_METHODDEF \ - {"siginterrupt", (PyCFunction)signal_siginterrupt, METH_VARARGS, signal_siginterrupt__doc__}, + {"siginterrupt", (PyCFunction)signal_siginterrupt, METH_FASTCALL, signal_siginterrupt__doc__}, static PyObject * signal_siginterrupt_impl(PyObject *module, int signalnum, int flag); static PyObject * -signal_siginterrupt(PyObject *module, PyObject *args) +signal_siginterrupt(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int signalnum; int flag; - if (!PyArg_ParseTuple(args, "ii:siginterrupt", + if (!_PyArg_ParseStack(args, nargs, "ii:siginterrupt", &signalnum, &flag)) { goto exit; } + + if (!_PyArg_NoStackKeywords("siginterrupt", kwnames)) { + goto exit; + } return_value = signal_siginterrupt_impl(module, signalnum, flag); exit: @@ -179,24 +187,28 @@ PyDoc_STRVAR(signal_setitimer__doc__, "Returns old values as a tuple: (delay, interval)."); #define SIGNAL_SETITIMER_METHODDEF \ - {"setitimer", (PyCFunction)signal_setitimer, METH_VARARGS, signal_setitimer__doc__}, + {"setitimer", (PyCFunction)signal_setitimer, METH_FASTCALL, signal_setitimer__doc__}, static PyObject * signal_setitimer_impl(PyObject *module, int which, double seconds, double interval); static PyObject * -signal_setitimer(PyObject *module, PyObject *args) +signal_setitimer(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int which; double seconds; double interval = 0.0; - if (!PyArg_ParseTuple(args, "id|d:setitimer", + if (!_PyArg_ParseStack(args, nargs, "id|d:setitimer", &which, &seconds, &interval)) { goto exit; } + + if (!_PyArg_NoStackKeywords("setitimer", kwnames)) { + goto exit; + } return_value = signal_setitimer_impl(module, which, seconds, interval); exit: @@ -245,22 +257,26 @@ PyDoc_STRVAR(signal_pthread_sigmask__doc__, "Fetch and/or change the signal mask of the calling thread."); #define SIGNAL_PTHREAD_SIGMASK_METHODDEF \ - {"pthread_sigmask", (PyCFunction)signal_pthread_sigmask, METH_VARARGS, signal_pthread_sigmask__doc__}, + {"pthread_sigmask", (PyCFunction)signal_pthread_sigmask, METH_FASTCALL, signal_pthread_sigmask__doc__}, static PyObject * signal_pthread_sigmask_impl(PyObject *module, int how, PyObject *mask); static PyObject * -signal_pthread_sigmask(PyObject *module, PyObject *args) +signal_pthread_sigmask(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int how; PyObject *mask; - if (!PyArg_ParseTuple(args, "iO:pthread_sigmask", + if (!_PyArg_ParseStack(args, nargs, "iO:pthread_sigmask", &how, &mask)) { goto exit; } + + if (!_PyArg_NoStackKeywords("pthread_sigmask", kwnames)) { + goto exit; + } return_value = signal_pthread_sigmask_impl(module, how, mask); exit: @@ -337,24 +353,28 @@ PyDoc_STRVAR(signal_sigtimedwait__doc__, "The timeout is specified in seconds, with floating point numbers allowed."); #define SIGNAL_SIGTIMEDWAIT_METHODDEF \ - {"sigtimedwait", (PyCFunction)signal_sigtimedwait, METH_VARARGS, signal_sigtimedwait__doc__}, + {"sigtimedwait", (PyCFunction)signal_sigtimedwait, METH_FASTCALL, signal_sigtimedwait__doc__}, static PyObject * signal_sigtimedwait_impl(PyObject *module, PyObject *sigset, PyObject *timeout_obj); static PyObject * -signal_sigtimedwait(PyObject *module, PyObject *args) +signal_sigtimedwait(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *sigset; PyObject *timeout_obj; - if (!PyArg_UnpackTuple(args, "sigtimedwait", + if (!_PyArg_UnpackStack(args, nargs, "sigtimedwait", 2, 2, &sigset, &timeout_obj)) { goto exit; } + + if (!_PyArg_NoStackKeywords("sigtimedwait", kwnames)) { + goto exit; + } return_value = signal_sigtimedwait_impl(module, sigset, timeout_obj); exit: @@ -372,22 +392,26 @@ PyDoc_STRVAR(signal_pthread_kill__doc__, "Send a signal to a thread."); #define SIGNAL_PTHREAD_KILL_METHODDEF \ - {"pthread_kill", (PyCFunction)signal_pthread_kill, METH_VARARGS, signal_pthread_kill__doc__}, + {"pthread_kill", (PyCFunction)signal_pthread_kill, METH_FASTCALL, signal_pthread_kill__doc__}, static PyObject * signal_pthread_kill_impl(PyObject *module, long thread_id, int signalnum); static PyObject * -signal_pthread_kill(PyObject *module, PyObject *args) +signal_pthread_kill(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; long thread_id; int signalnum; - if (!PyArg_ParseTuple(args, "li:pthread_kill", + if (!_PyArg_ParseStack(args, nargs, "li:pthread_kill", &thread_id, &signalnum)) { goto exit; } + + if (!_PyArg_NoStackKeywords("pthread_kill", kwnames)) { + goto exit; + } return_value = signal_pthread_kill_impl(module, thread_id, signalnum); exit: @@ -439,4 +463,4 @@ exit: #ifndef SIGNAL_PTHREAD_KILL_METHODDEF #define SIGNAL_PTHREAD_KILL_METHODDEF #endif /* !defined(SIGNAL_PTHREAD_KILL_METHODDEF) */ -/*[clinic end generated code: output=c6990ef0d0ba72b6 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=fab3dba32c058588 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/unicodedata.c.h b/Modules/clinic/unicodedata.c.h index d481ccbe64..c3a5910b49 100644 --- a/Modules/clinic/unicodedata.c.h +++ b/Modules/clinic/unicodedata.c.h @@ -13,23 +13,27 @@ PyDoc_STRVAR(unicodedata_UCD_decimal__doc__, "ValueError is raised."); #define UNICODEDATA_UCD_DECIMAL_METHODDEF \ - {"decimal", (PyCFunction)unicodedata_UCD_decimal, METH_VARARGS, unicodedata_UCD_decimal__doc__}, + {"decimal", (PyCFunction)unicodedata_UCD_decimal, METH_FASTCALL, unicodedata_UCD_decimal__doc__}, static PyObject * unicodedata_UCD_decimal_impl(PyObject *self, int chr, PyObject *default_value); static PyObject * -unicodedata_UCD_decimal(PyObject *self, PyObject *args) +unicodedata_UCD_decimal(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int chr; PyObject *default_value = NULL; - if (!PyArg_ParseTuple(args, "C|O:decimal", + if (!_PyArg_ParseStack(args, nargs, "C|O:decimal", &chr, &default_value)) { goto exit; } + + if (!_PyArg_NoStackKeywords("decimal", kwnames)) { + goto exit; + } return_value = unicodedata_UCD_decimal_impl(self, chr, default_value); exit: @@ -47,22 +51,26 @@ PyDoc_STRVAR(unicodedata_UCD_digit__doc__, "ValueError is raised."); #define UNICODEDATA_UCD_DIGIT_METHODDEF \ - {"digit", (PyCFunction)unicodedata_UCD_digit, METH_VARARGS, unicodedata_UCD_digit__doc__}, + {"digit", (PyCFunction)unicodedata_UCD_digit, METH_FASTCALL, unicodedata_UCD_digit__doc__}, static PyObject * unicodedata_UCD_digit_impl(PyObject *self, int chr, PyObject *default_value); static PyObject * -unicodedata_UCD_digit(PyObject *self, PyObject *args) +unicodedata_UCD_digit(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int chr; PyObject *default_value = NULL; - if (!PyArg_ParseTuple(args, "C|O:digit", + if (!_PyArg_ParseStack(args, nargs, "C|O:digit", &chr, &default_value)) { goto exit; } + + if (!_PyArg_NoStackKeywords("digit", kwnames)) { + goto exit; + } return_value = unicodedata_UCD_digit_impl(self, chr, default_value); exit: @@ -80,23 +88,27 @@ PyDoc_STRVAR(unicodedata_UCD_numeric__doc__, "ValueError is raised."); #define UNICODEDATA_UCD_NUMERIC_METHODDEF \ - {"numeric", (PyCFunction)unicodedata_UCD_numeric, METH_VARARGS, unicodedata_UCD_numeric__doc__}, + {"numeric", (PyCFunction)unicodedata_UCD_numeric, METH_FASTCALL, unicodedata_UCD_numeric__doc__}, static PyObject * unicodedata_UCD_numeric_impl(PyObject *self, int chr, PyObject *default_value); static PyObject * -unicodedata_UCD_numeric(PyObject *self, PyObject *args) +unicodedata_UCD_numeric(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int chr; PyObject *default_value = NULL; - if (!PyArg_ParseTuple(args, "C|O:numeric", + if (!_PyArg_ParseStack(args, nargs, "C|O:numeric", &chr, &default_value)) { goto exit; } + + if (!_PyArg_NoStackKeywords("numeric", kwnames)) { + goto exit; + } return_value = unicodedata_UCD_numeric_impl(self, chr, default_value); exit: @@ -293,21 +305,25 @@ PyDoc_STRVAR(unicodedata_UCD_normalize__doc__, "Valid values for form are \'NFC\', \'NFKC\', \'NFD\', and \'NFKD\'."); #define UNICODEDATA_UCD_NORMALIZE_METHODDEF \ - {"normalize", (PyCFunction)unicodedata_UCD_normalize, METH_VARARGS, unicodedata_UCD_normalize__doc__}, + {"normalize", (PyCFunction)unicodedata_UCD_normalize, METH_FASTCALL, unicodedata_UCD_normalize__doc__}, static PyObject * unicodedata_UCD_normalize_impl(PyObject *self, const char *form, PyObject *input); static PyObject * -unicodedata_UCD_normalize(PyObject *self, PyObject *args) +unicodedata_UCD_normalize(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; const char *form; PyObject *input; - if (!PyArg_ParseTuple(args, "sO!:normalize", - &form, &PyUnicode_Type, &input)) { + if (!_PyArg_ParseStack(args, nargs, "sU:normalize", + &form, &input)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("normalize", kwnames)) { goto exit; } return_value = unicodedata_UCD_normalize_impl(self, form, input); @@ -326,22 +342,26 @@ PyDoc_STRVAR(unicodedata_UCD_name__doc__, "ValueError is raised."); #define UNICODEDATA_UCD_NAME_METHODDEF \ - {"name", (PyCFunction)unicodedata_UCD_name, METH_VARARGS, unicodedata_UCD_name__doc__}, + {"name", (PyCFunction)unicodedata_UCD_name, METH_FASTCALL, unicodedata_UCD_name__doc__}, static PyObject * unicodedata_UCD_name_impl(PyObject *self, int chr, PyObject *default_value); static PyObject * -unicodedata_UCD_name(PyObject *self, PyObject *args) +unicodedata_UCD_name(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int chr; PyObject *default_value = NULL; - if (!PyArg_ParseTuple(args, "C|O:name", + if (!_PyArg_ParseStack(args, nargs, "C|O:name", &chr, &default_value)) { goto exit; } + + if (!_PyArg_NoStackKeywords("name", kwnames)) { + goto exit; + } return_value = unicodedata_UCD_name_impl(self, chr, default_value); exit: @@ -379,4 +399,4 @@ unicodedata_UCD_lookup(PyObject *self, PyObject *arg) exit: return return_value; } -/*[clinic end generated code: output=5313ce129da87b2f input=a9049054013a1b77]*/ +/*[clinic end generated code: output=fcb86aaa3fa40876 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/zlibmodule.c.h b/Modules/clinic/zlibmodule.c.h index fda392a9cd..a9089ca7bb 100644 --- a/Modules/clinic/zlibmodule.c.h +++ b/Modules/clinic/zlibmodule.c.h @@ -28,7 +28,7 @@ zlib_compress(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwn Py_buffer data = {NULL, NULL}; int level = Z_DEFAULT_COMPRESSION; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &data, &level)) { goto exit; } @@ -73,7 +73,7 @@ zlib_decompress(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *k int wbits = MAX_WBITS; Py_ssize_t bufsize = DEF_BUF_SIZE; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &data, &wbits, ssize_t_converter, &bufsize)) { goto exit; } @@ -138,7 +138,7 @@ zlib_compressobj(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject * int strategy = Z_DEFAULT_STRATEGY; Py_buffer zdict = {NULL, NULL}; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &level, &method, &wbits, &memLevel, &strategy, &zdict)) { goto exit; } @@ -180,7 +180,7 @@ zlib_decompressobj(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject int wbits = MAX_WBITS; PyObject *zdict = NULL; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &wbits, &zdict)) { goto exit; } @@ -262,7 +262,7 @@ zlib_Decompress_decompress(compobject *self, PyObject **args, Py_ssize_t nargs, Py_buffer data = {NULL, NULL}; Py_ssize_t max_length = 0; - if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &data, ssize_t_converter, &max_length)) { goto exit; } @@ -290,21 +290,25 @@ PyDoc_STRVAR(zlib_Compress_flush__doc__, " can still be compressed."); #define ZLIB_COMPRESS_FLUSH_METHODDEF \ - {"flush", (PyCFunction)zlib_Compress_flush, METH_VARARGS, zlib_Compress_flush__doc__}, + {"flush", (PyCFunction)zlib_Compress_flush, METH_FASTCALL, zlib_Compress_flush__doc__}, static PyObject * zlib_Compress_flush_impl(compobject *self, int mode); static PyObject * -zlib_Compress_flush(compobject *self, PyObject *args) +zlib_Compress_flush(compobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; int mode = Z_FINISH; - if (!PyArg_ParseTuple(args, "|i:flush", + if (!_PyArg_ParseStack(args, nargs, "|i:flush", &mode)) { goto exit; } + + if (!_PyArg_NoStackKeywords("flush", kwnames)) { + goto exit; + } return_value = zlib_Compress_flush_impl(self, mode); exit: @@ -365,21 +369,25 @@ PyDoc_STRVAR(zlib_Decompress_flush__doc__, " the initial size of the output buffer."); #define ZLIB_DECOMPRESS_FLUSH_METHODDEF \ - {"flush", (PyCFunction)zlib_Decompress_flush, METH_VARARGS, zlib_Decompress_flush__doc__}, + {"flush", (PyCFunction)zlib_Decompress_flush, METH_FASTCALL, zlib_Decompress_flush__doc__}, static PyObject * zlib_Decompress_flush_impl(compobject *self, Py_ssize_t length); static PyObject * -zlib_Decompress_flush(compobject *self, PyObject *args) +zlib_Decompress_flush(compobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_ssize_t length = DEF_BUF_SIZE; - if (!PyArg_ParseTuple(args, "|O&:flush", + if (!_PyArg_ParseStack(args, nargs, "|O&:flush", ssize_t_converter, &length)) { goto exit; } + + if (!_PyArg_NoStackKeywords("flush", kwnames)) { + goto exit; + } return_value = zlib_Decompress_flush_impl(self, length); exit: @@ -398,22 +406,26 @@ PyDoc_STRVAR(zlib_adler32__doc__, "The returned checksum is an integer."); #define ZLIB_ADLER32_METHODDEF \ - {"adler32", (PyCFunction)zlib_adler32, METH_VARARGS, zlib_adler32__doc__}, + {"adler32", (PyCFunction)zlib_adler32, METH_FASTCALL, zlib_adler32__doc__}, static PyObject * zlib_adler32_impl(PyObject *module, Py_buffer *data, unsigned int value); static PyObject * -zlib_adler32(PyObject *module, PyObject *args) +zlib_adler32(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; unsigned int value = 1; - if (!PyArg_ParseTuple(args, "y*|I:adler32", + if (!_PyArg_ParseStack(args, nargs, "y*|I:adler32", &data, &value)) { goto exit; } + + if (!_PyArg_NoStackKeywords("adler32", kwnames)) { + goto exit; + } return_value = zlib_adler32_impl(module, &data, value); exit: @@ -437,22 +449,26 @@ PyDoc_STRVAR(zlib_crc32__doc__, "The returned checksum is an integer."); #define ZLIB_CRC32_METHODDEF \ - {"crc32", (PyCFunction)zlib_crc32, METH_VARARGS, zlib_crc32__doc__}, + {"crc32", (PyCFunction)zlib_crc32, METH_FASTCALL, zlib_crc32__doc__}, static PyObject * zlib_crc32_impl(PyObject *module, Py_buffer *data, unsigned int value); static PyObject * -zlib_crc32(PyObject *module, PyObject *args) +zlib_crc32(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; unsigned int value = 0; - if (!PyArg_ParseTuple(args, "y*|I:crc32", + if (!_PyArg_ParseStack(args, nargs, "y*|I:crc32", &data, &value)) { goto exit; } + + if (!_PyArg_NoStackKeywords("crc32", kwnames)) { + goto exit; + } return_value = zlib_crc32_impl(module, &data, value); exit: @@ -467,4 +483,4 @@ exit: #ifndef ZLIB_COMPRESS_COPY_METHODDEF #define ZLIB_COMPRESS_COPY_METHODDEF #endif /* !defined(ZLIB_COMPRESS_COPY_METHODDEF) */ -/*[clinic end generated code: output=3a4e2bfe750423a3 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=fa1b5f4a6208c342 input=a9049054013a1b77]*/ |