diff options
Diffstat (limited to 'Modules/clinic')
33 files changed, 1627 insertions, 887 deletions
diff --git a/Modules/clinic/_bz2module.c.h b/Modules/clinic/_bz2module.c.h index 3ed8303e..c4032ea 100644 --- a/Modules/clinic/_bz2module.c.h +++ b/Modules/clinic/_bz2module.c.h @@ -25,14 +25,16 @@ _bz2_BZ2Compressor_compress(BZ2Compressor *self, PyObject *arg) PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:compress", &data)) + if (!PyArg_Parse(arg, "y*:compress", &data)) { goto exit; + } return_value = _bz2_BZ2Compressor_compress_impl(self, &data); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -80,11 +82,13 @@ _bz2_BZ2Compressor___init__(PyObject *self, PyObject *args, PyObject *kwargs) int compresslevel = 9; if ((Py_TYPE(self) == &BZ2Compressor_Type) && - !_PyArg_NoKeywords("BZ2Compressor", kwargs)) + !_PyArg_NoKeywords("BZ2Compressor", kwargs)) { goto exit; + } if (!PyArg_ParseTuple(args, "|i:BZ2Compressor", - &compresslevel)) + &compresslevel)) { goto exit; + } return_value = _bz2_BZ2Compressor___init___impl((BZ2Compressor *)self, compresslevel); exit: @@ -121,19 +125,22 @@ static PyObject * _bz2_BZ2Decompressor_decompress(BZ2Decompressor *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"data", "max_length", NULL}; + static const char * const _keywords[] = {"data", "max_length", NULL}; + static _PyArg_Parser _parser = {"y*|n:decompress", _keywords, 0}; Py_buffer data = {NULL, NULL}; Py_ssize_t max_length = -1; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "y*|n:decompress", _keywords, - &data, &max_length)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &data, &max_length)) { goto exit; + } return_value = _bz2_BZ2Decompressor_decompress_impl(self, &data, max_length); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -155,14 +162,16 @@ _bz2_BZ2Decompressor___init__(PyObject *self, PyObject *args, PyObject *kwargs) int return_value = -1; if ((Py_TYPE(self) == &BZ2Decompressor_Type) && - !_PyArg_NoPositional("BZ2Decompressor", args)) + !_PyArg_NoPositional("BZ2Decompressor", args)) { goto exit; + } if ((Py_TYPE(self) == &BZ2Decompressor_Type) && - !_PyArg_NoKeywords("BZ2Decompressor", kwargs)) + !_PyArg_NoKeywords("BZ2Decompressor", kwargs)) { goto exit; + } return_value = _bz2_BZ2Decompressor___init___impl((BZ2Decompressor *)self); exit: return return_value; } -/*[clinic end generated code: output=fef29b76b3314fc7 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=40e5ef049f9e719b input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_codecsmodule.c.h b/Modules/clinic/_codecsmodule.c.h index af06c6d..090b1ef 100644 --- a/Modules/clinic/_codecsmodule.c.h +++ b/Modules/clinic/_codecsmodule.c.h @@ -33,8 +33,9 @@ _codecs_lookup(PyObject *module, PyObject *arg) PyObject *return_value = NULL; const char *encoding; - if (!PyArg_Parse(arg, "s:lookup", &encoding)) + if (!PyArg_Parse(arg, "s:lookup", &encoding)) { goto exit; + } return_value = _codecs_lookup_impl(module, encoding); exit: @@ -64,14 +65,16 @@ static PyObject * _codecs_encode(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"obj", "encoding", "errors", NULL}; + static const char * const _keywords[] = {"obj", "encoding", "errors", NULL}; + static _PyArg_Parser _parser = {"O|ss:encode", _keywords, 0}; PyObject *obj; const char *encoding = NULL; const char *errors = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|ss:encode", _keywords, - &obj, &encoding, &errors)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &obj, &encoding, &errors)) { goto exit; + } return_value = _codecs_encode_impl(module, obj, encoding, errors); exit: @@ -101,14 +104,16 @@ static PyObject * _codecs_decode(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"obj", "encoding", "errors", NULL}; + static const char * const _keywords[] = {"obj", "encoding", "errors", NULL}; + static _PyArg_Parser _parser = {"O|ss:decode", _keywords, 0}; PyObject *obj; const char *encoding = NULL; const char *errors = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|ss:decode", _keywords, - &obj, &encoding, &errors)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &obj, &encoding, &errors)) { goto exit; + } return_value = _codecs_decode_impl(module, obj, encoding, errors); exit: @@ -133,8 +138,9 @@ _codecs__forget_codec(PyObject *module, PyObject *arg) PyObject *return_value = NULL; const char *encoding; - if (!PyArg_Parse(arg, "s:_forget_codec", &encoding)) + if (!PyArg_Parse(arg, "s:_forget_codec", &encoding)) { goto exit; + } return_value = _codecs__forget_codec_impl(module, encoding); exit: @@ -161,14 +167,16 @@ _codecs_escape_decode(PyObject *module, PyObject *args) const char *errors = NULL; if (!PyArg_ParseTuple(args, "s*|z:escape_decode", - &data, &errors)) + &data, &errors)) { goto exit; + } return_value = _codecs_escape_decode_impl(module, &data, errors); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -193,8 +201,9 @@ _codecs_escape_encode(PyObject *module, PyObject *args) const char *errors = NULL; if (!PyArg_ParseTuple(args, "O!|z:escape_encode", - &PyBytes_Type, &data, &errors)) + &PyBytes_Type, &data, &errors)) { goto exit; + } return_value = _codecs_escape_encode_impl(module, data, errors); exit: @@ -221,8 +230,9 @@ _codecs_unicode_internal_decode(PyObject *module, PyObject *args) const char *errors = NULL; if (!PyArg_ParseTuple(args, "O|z:unicode_internal_decode", - &obj, &errors)) + &obj, &errors)) { goto exit; + } return_value = _codecs_unicode_internal_decode_impl(module, obj, errors); exit: @@ -250,14 +260,16 @@ _codecs_utf_7_decode(PyObject *module, PyObject *args) int final = 0; if (!PyArg_ParseTuple(args, "y*|zi:utf_7_decode", - &data, &errors, &final)) + &data, &errors, &final)) { goto exit; + } return_value = _codecs_utf_7_decode_impl(module, &data, errors, final); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -283,14 +295,16 @@ _codecs_utf_8_decode(PyObject *module, PyObject *args) int final = 0; if (!PyArg_ParseTuple(args, "y*|zi:utf_8_decode", - &data, &errors, &final)) + &data, &errors, &final)) { goto exit; + } return_value = _codecs_utf_8_decode_impl(module, &data, errors, final); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -316,14 +330,16 @@ _codecs_utf_16_decode(PyObject *module, PyObject *args) int final = 0; if (!PyArg_ParseTuple(args, "y*|zi:utf_16_decode", - &data, &errors, &final)) + &data, &errors, &final)) { goto exit; + } return_value = _codecs_utf_16_decode_impl(module, &data, errors, final); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -349,14 +365,16 @@ _codecs_utf_16_le_decode(PyObject *module, PyObject *args) int final = 0; if (!PyArg_ParseTuple(args, "y*|zi:utf_16_le_decode", - &data, &errors, &final)) + &data, &errors, &final)) { goto exit; + } return_value = _codecs_utf_16_le_decode_impl(module, &data, errors, final); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -382,14 +400,16 @@ _codecs_utf_16_be_decode(PyObject *module, PyObject *args) int final = 0; if (!PyArg_ParseTuple(args, "y*|zi:utf_16_be_decode", - &data, &errors, &final)) + &data, &errors, &final)) { goto exit; + } return_value = _codecs_utf_16_be_decode_impl(module, &data, errors, final); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -417,14 +437,16 @@ _codecs_utf_16_ex_decode(PyObject *module, PyObject *args) int final = 0; if (!PyArg_ParseTuple(args, "y*|zii:utf_16_ex_decode", - &data, &errors, &byteorder, &final)) + &data, &errors, &byteorder, &final)) { goto exit; + } return_value = _codecs_utf_16_ex_decode_impl(module, &data, errors, byteorder, final); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -450,14 +472,16 @@ _codecs_utf_32_decode(PyObject *module, PyObject *args) int final = 0; if (!PyArg_ParseTuple(args, "y*|zi:utf_32_decode", - &data, &errors, &final)) + &data, &errors, &final)) { goto exit; + } return_value = _codecs_utf_32_decode_impl(module, &data, errors, final); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -483,14 +507,16 @@ _codecs_utf_32_le_decode(PyObject *module, PyObject *args) int final = 0; if (!PyArg_ParseTuple(args, "y*|zi:utf_32_le_decode", - &data, &errors, &final)) + &data, &errors, &final)) { goto exit; + } return_value = _codecs_utf_32_le_decode_impl(module, &data, errors, final); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -516,14 +542,16 @@ _codecs_utf_32_be_decode(PyObject *module, PyObject *args) int final = 0; if (!PyArg_ParseTuple(args, "y*|zi:utf_32_be_decode", - &data, &errors, &final)) + &data, &errors, &final)) { goto exit; + } return_value = _codecs_utf_32_be_decode_impl(module, &data, errors, final); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -551,14 +579,16 @@ _codecs_utf_32_ex_decode(PyObject *module, PyObject *args) int final = 0; if (!PyArg_ParseTuple(args, "y*|zii:utf_32_ex_decode", - &data, &errors, &byteorder, &final)) + &data, &errors, &byteorder, &final)) { goto exit; + } return_value = _codecs_utf_32_ex_decode_impl(module, &data, errors, byteorder, final); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -583,14 +613,16 @@ _codecs_unicode_escape_decode(PyObject *module, PyObject *args) const char *errors = NULL; if (!PyArg_ParseTuple(args, "s*|z:unicode_escape_decode", - &data, &errors)) + &data, &errors)) { goto exit; + } return_value = _codecs_unicode_escape_decode_impl(module, &data, errors); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -615,14 +647,16 @@ _codecs_raw_unicode_escape_decode(PyObject *module, PyObject *args) const char *errors = NULL; if (!PyArg_ParseTuple(args, "s*|z:raw_unicode_escape_decode", - &data, &errors)) + &data, &errors)) { goto exit; + } return_value = _codecs_raw_unicode_escape_decode_impl(module, &data, errors); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -647,14 +681,16 @@ _codecs_latin_1_decode(PyObject *module, PyObject *args) const char *errors = NULL; if (!PyArg_ParseTuple(args, "y*|z:latin_1_decode", - &data, &errors)) + &data, &errors)) { goto exit; + } return_value = _codecs_latin_1_decode_impl(module, &data, errors); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -679,14 +715,16 @@ _codecs_ascii_decode(PyObject *module, PyObject *args) const char *errors = NULL; if (!PyArg_ParseTuple(args, "y*|z:ascii_decode", - &data, &errors)) + &data, &errors)) { goto exit; + } return_value = _codecs_ascii_decode_impl(module, &data, errors); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -712,14 +750,16 @@ _codecs_charmap_decode(PyObject *module, PyObject *args) PyObject *mapping = NULL; if (!PyArg_ParseTuple(args, "y*|zO:charmap_decode", - &data, &errors, &mapping)) + &data, &errors, &mapping)) { goto exit; + } return_value = _codecs_charmap_decode_impl(module, &data, errors, mapping); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -747,14 +787,16 @@ _codecs_mbcs_decode(PyObject *module, PyObject *args) int final = 0; if (!PyArg_ParseTuple(args, "y*|zi:mbcs_decode", - &data, &errors, &final)) + &data, &errors, &final)) { goto exit; + } return_value = _codecs_mbcs_decode_impl(module, &data, errors, final); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -785,14 +827,16 @@ _codecs_code_page_decode(PyObject *module, PyObject *args) int final = 0; if (!PyArg_ParseTuple(args, "iy*|zi:code_page_decode", - &codepage, &data, &errors, &final)) + &codepage, &data, &errors, &final)) { goto exit; + } return_value = _codecs_code_page_decode_impl(module, codepage, &data, errors, final); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -819,14 +863,16 @@ _codecs_readbuffer_encode(PyObject *module, PyObject *args) const char *errors = NULL; if (!PyArg_ParseTuple(args, "s*|z:readbuffer_encode", - &data, &errors)) + &data, &errors)) { goto exit; + } return_value = _codecs_readbuffer_encode_impl(module, &data, errors); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -851,8 +897,9 @@ _codecs_unicode_internal_encode(PyObject *module, PyObject *args) const char *errors = NULL; if (!PyArg_ParseTuple(args, "O|z:unicode_internal_encode", - &obj, &errors)) + &obj, &errors)) { goto exit; + } return_value = _codecs_unicode_internal_encode_impl(module, obj, errors); exit: @@ -878,9 +925,10 @@ _codecs_utf_7_encode(PyObject *module, PyObject *args) PyObject *str; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "O|z:utf_7_encode", - &str, &errors)) + if (!PyArg_ParseTuple(args, "U|z:utf_7_encode", + &str, &errors)) { goto exit; + } return_value = _codecs_utf_7_encode_impl(module, str, errors); exit: @@ -906,9 +954,10 @@ _codecs_utf_8_encode(PyObject *module, PyObject *args) PyObject *str; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "O|z:utf_8_encode", - &str, &errors)) + if (!PyArg_ParseTuple(args, "U|z:utf_8_encode", + &str, &errors)) { goto exit; + } return_value = _codecs_utf_8_encode_impl(module, str, errors); exit: @@ -935,9 +984,10 @@ _codecs_utf_16_encode(PyObject *module, PyObject *args) const char *errors = NULL; int byteorder = 0; - if (!PyArg_ParseTuple(args, "O|zi:utf_16_encode", - &str, &errors, &byteorder)) + if (!PyArg_ParseTuple(args, "U|zi:utf_16_encode", + &str, &errors, &byteorder)) { goto exit; + } return_value = _codecs_utf_16_encode_impl(module, str, errors, byteorder); exit: @@ -963,9 +1013,10 @@ _codecs_utf_16_le_encode(PyObject *module, PyObject *args) PyObject *str; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "O|z:utf_16_le_encode", - &str, &errors)) + if (!PyArg_ParseTuple(args, "U|z:utf_16_le_encode", + &str, &errors)) { goto exit; + } return_value = _codecs_utf_16_le_encode_impl(module, str, errors); exit: @@ -991,9 +1042,10 @@ _codecs_utf_16_be_encode(PyObject *module, PyObject *args) PyObject *str; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "O|z:utf_16_be_encode", - &str, &errors)) + if (!PyArg_ParseTuple(args, "U|z:utf_16_be_encode", + &str, &errors)) { goto exit; + } return_value = _codecs_utf_16_be_encode_impl(module, str, errors); exit: @@ -1020,9 +1072,10 @@ _codecs_utf_32_encode(PyObject *module, PyObject *args) const char *errors = NULL; int byteorder = 0; - if (!PyArg_ParseTuple(args, "O|zi:utf_32_encode", - &str, &errors, &byteorder)) + if (!PyArg_ParseTuple(args, "U|zi:utf_32_encode", + &str, &errors, &byteorder)) { goto exit; + } return_value = _codecs_utf_32_encode_impl(module, str, errors, byteorder); exit: @@ -1048,9 +1101,10 @@ _codecs_utf_32_le_encode(PyObject *module, PyObject *args) PyObject *str; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "O|z:utf_32_le_encode", - &str, &errors)) + if (!PyArg_ParseTuple(args, "U|z:utf_32_le_encode", + &str, &errors)) { goto exit; + } return_value = _codecs_utf_32_le_encode_impl(module, str, errors); exit: @@ -1076,9 +1130,10 @@ _codecs_utf_32_be_encode(PyObject *module, PyObject *args) PyObject *str; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "O|z:utf_32_be_encode", - &str, &errors)) + if (!PyArg_ParseTuple(args, "U|z:utf_32_be_encode", + &str, &errors)) { goto exit; + } return_value = _codecs_utf_32_be_encode_impl(module, str, errors); exit: @@ -1104,9 +1159,10 @@ _codecs_unicode_escape_encode(PyObject *module, PyObject *args) PyObject *str; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "O|z:unicode_escape_encode", - &str, &errors)) + if (!PyArg_ParseTuple(args, "U|z:unicode_escape_encode", + &str, &errors)) { goto exit; + } return_value = _codecs_unicode_escape_encode_impl(module, str, errors); exit: @@ -1132,9 +1188,10 @@ _codecs_raw_unicode_escape_encode(PyObject *module, PyObject *args) PyObject *str; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "O|z:raw_unicode_escape_encode", - &str, &errors)) + if (!PyArg_ParseTuple(args, "U|z:raw_unicode_escape_encode", + &str, &errors)) { goto exit; + } return_value = _codecs_raw_unicode_escape_encode_impl(module, str, errors); exit: @@ -1160,9 +1217,10 @@ _codecs_latin_1_encode(PyObject *module, PyObject *args) PyObject *str; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "O|z:latin_1_encode", - &str, &errors)) + if (!PyArg_ParseTuple(args, "U|z:latin_1_encode", + &str, &errors)) { goto exit; + } return_value = _codecs_latin_1_encode_impl(module, str, errors); exit: @@ -1188,9 +1246,10 @@ _codecs_ascii_encode(PyObject *module, PyObject *args) PyObject *str; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "O|z:ascii_encode", - &str, &errors)) + if (!PyArg_ParseTuple(args, "U|z:ascii_encode", + &str, &errors)) { goto exit; + } return_value = _codecs_ascii_encode_impl(module, str, errors); exit: @@ -1217,9 +1276,10 @@ _codecs_charmap_encode(PyObject *module, PyObject *args) const char *errors = NULL; PyObject *mapping = NULL; - if (!PyArg_ParseTuple(args, "O|zO:charmap_encode", - &str, &errors, &mapping)) + if (!PyArg_ParseTuple(args, "U|zO:charmap_encode", + &str, &errors, &mapping)) { goto exit; + } return_value = _codecs_charmap_encode_impl(module, str, errors, mapping); exit: @@ -1243,8 +1303,9 @@ _codecs_charmap_build(PyObject *module, PyObject *arg) PyObject *return_value = NULL; PyObject *map; - if (!PyArg_Parse(arg, "U:charmap_build", &map)) + if (!PyArg_Parse(arg, "U:charmap_build", &map)) { goto exit; + } return_value = _codecs_charmap_build_impl(module, map); exit: @@ -1271,9 +1332,10 @@ _codecs_mbcs_encode(PyObject *module, PyObject *args) PyObject *str; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "O|z:mbcs_encode", - &str, &errors)) + if (!PyArg_ParseTuple(args, "U|z:mbcs_encode", + &str, &errors)) { goto exit; + } return_value = _codecs_mbcs_encode_impl(module, str, errors); exit: @@ -1304,9 +1366,10 @@ _codecs_code_page_encode(PyObject *module, PyObject *args) PyObject *str; const char *errors = NULL; - if (!PyArg_ParseTuple(args, "iO|z:code_page_encode", - &code_page, &str, &errors)) + if (!PyArg_ParseTuple(args, "iU|z:code_page_encode", + &code_page, &str, &errors)) { goto exit; + } return_value = _codecs_code_page_encode_impl(module, code_page, str, errors); exit: @@ -1340,8 +1403,9 @@ _codecs_register_error(PyObject *module, PyObject *args) PyObject *handler; if (!PyArg_ParseTuple(args, "sO:register_error", - &errors, &handler)) + &errors, &handler)) { goto exit; + } return_value = _codecs_register_error_impl(module, errors, handler); exit: @@ -1369,8 +1433,9 @@ _codecs_lookup_error(PyObject *module, PyObject *arg) PyObject *return_value = NULL; const char *name; - if (!PyArg_Parse(arg, "s:lookup_error", &name)) + if (!PyArg_Parse(arg, "s:lookup_error", &name)) { goto exit; + } return_value = _codecs_lookup_error_impl(module, name); exit: @@ -1392,4 +1457,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=42fed94e2ab765ba input=a9049054013a1b77]*/ +/*[clinic end generated code: output=0221e4eece62c905 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_cryptmodule.c.h b/Modules/clinic/_cryptmodule.c.h index a3c371c..412c6fe 100644 --- a/Modules/clinic/_cryptmodule.c.h +++ b/Modules/clinic/_cryptmodule.c.h @@ -27,11 +27,12 @@ crypt_crypt(PyObject *module, PyObject *args) const char *salt; if (!PyArg_ParseTuple(args, "ss:crypt", - &word, &salt)) + &word, &salt)) { goto exit; + } return_value = crypt_crypt_impl(module, word, salt); exit: return return_value; } -/*[clinic end generated code: output=e0493a9691537690 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=8dfc88264e662df4 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_cursesmodule.c.h b/Modules/clinic/_cursesmodule.c.h index 5e11742..62ff1c8 100644 --- a/Modules/clinic/_cursesmodule.c.h +++ b/Modules/clinic/_cursesmodule.c.h @@ -40,22 +40,26 @@ curses_window_addch(PyCursesWindowObject *self, PyObject *args) switch (PyTuple_GET_SIZE(args)) { case 1: - if (!PyArg_ParseTuple(args, "O:addch", &ch)) + if (!PyArg_ParseTuple(args, "O:addch", &ch)) { goto exit; + } break; case 2: - if (!PyArg_ParseTuple(args, "Ol:addch", &ch, &attr)) + if (!PyArg_ParseTuple(args, "Ol:addch", &ch, &attr)) { goto exit; + } group_right_1 = 1; break; case 3: - if (!PyArg_ParseTuple(args, "iiO:addch", &y, &x, &ch)) + if (!PyArg_ParseTuple(args, "iiO:addch", &y, &x, &ch)) { goto exit; + } group_left_1 = 1; break; case 4: - if (!PyArg_ParseTuple(args, "iiOl:addch", &y, &x, &ch, &attr)) + if (!PyArg_ParseTuple(args, "iiOl:addch", &y, &x, &ch, &attr)) { goto exit; + } group_right_1 = 1; group_left_1 = 1; break; @@ -68,4 +72,4 @@ curses_window_addch(PyCursesWindowObject *self, PyObject *args) exit: return return_value; } -/*[clinic end generated code: output=982b1e709577f3ec input=a9049054013a1b77]*/ +/*[clinic end generated code: output=13ffc5f8d79cbfbf input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_datetimemodule.c.h b/Modules/clinic/_datetimemodule.c.h index 688c903..cf09207 100644 --- a/Modules/clinic/_datetimemodule.c.h +++ b/Modules/clinic/_datetimemodule.c.h @@ -23,15 +23,17 @@ static PyObject * datetime_datetime_now(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"tz", NULL}; + static const char * const _keywords[] = {"tz", NULL}; + static _PyArg_Parser _parser = {"|O:now", _keywords, 0}; PyObject *tz = Py_None; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:now", _keywords, - &tz)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &tz)) { goto exit; + } return_value = datetime_datetime_now_impl(type, tz); exit: return return_value; } -/*[clinic end generated code: output=7f45c670d6e4953a input=a9049054013a1b77]*/ +/*[clinic end generated code: output=61f85af5637df8b5 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_dbmmodule.c.h b/Modules/clinic/_dbmmodule.c.h index 49cbceb..06cf7e6 100644 --- a/Modules/clinic/_dbmmodule.c.h +++ b/Modules/clinic/_dbmmodule.c.h @@ -60,8 +60,9 @@ _dbm_dbm_get(dbmobject *self, PyObject *args) PyObject *default_value = NULL; if (!PyArg_ParseTuple(args, "s#|O:get", - &key, &key_length, &default_value)) + &key, &key_length, &default_value)) { goto exit; + } return_value = _dbm_dbm_get_impl(self, key, key_length, default_value); exit: @@ -93,8 +94,9 @@ _dbm_dbm_setdefault(dbmobject *self, PyObject *args) PyObject *default_value = NULL; if (!PyArg_ParseTuple(args, "s#|O:setdefault", - &key, &key_length, &default_value)) + &key, &key_length, &default_value)) { goto exit; + } return_value = _dbm_dbm_setdefault_impl(self, key, key_length, default_value); exit: @@ -131,11 +133,12 @@ dbmopen(PyObject *module, PyObject *args) int mode = 438; if (!PyArg_ParseTuple(args, "s|si:open", - &filename, &flags, &mode)) + &filename, &flags, &mode)) { goto exit; + } return_value = dbmopen_impl(module, filename, flags, mode); exit: return return_value; } -/*[clinic end generated code: output=fff12f168cdf8b43 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=99adf966ef0475ff input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_elementtree.c.h b/Modules/clinic/_elementtree.c.h index 86b4c4c..c91dfbf 100644 --- a/Modules/clinic/_elementtree.c.h +++ b/Modules/clinic/_elementtree.c.h @@ -19,8 +19,9 @@ _elementtree_Element_append(ElementObject *self, PyObject *arg) PyObject *return_value = NULL; PyObject *subelement; - if (!PyArg_Parse(arg, "O!:append", &Element_Type, &subelement)) + if (!PyArg_Parse(arg, "O!:append", &Element_Type, &subelement)) { goto exit; + } return_value = _elementtree_Element_append_impl(self, subelement); exit: @@ -87,8 +88,9 @@ _elementtree_Element___sizeof__(ElementObject *self, PyObject *Py_UNUSED(ignored Py_ssize_t _return_value; _return_value = _elementtree_Element___sizeof___impl(self); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromSsize_t(_return_value); exit: @@ -144,13 +146,15 @@ static PyObject * _elementtree_Element_find(ElementObject *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", "namespaces", NULL}; + static const char * const _keywords[] = {"path", "namespaces", NULL}; + static _PyArg_Parser _parser = {"O|O:find", _keywords, 0}; PyObject *path; PyObject *namespaces = Py_None; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O:find", _keywords, - &path, &namespaces)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &path, &namespaces)) { goto exit; + } return_value = _elementtree_Element_find_impl(self, path, namespaces); exit: @@ -174,14 +178,16 @@ static PyObject * _elementtree_Element_findtext(ElementObject *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", "default", "namespaces", NULL}; + static const char * const _keywords[] = {"path", "default", "namespaces", NULL}; + static _PyArg_Parser _parser = {"O|OO:findtext", _keywords, 0}; PyObject *path; PyObject *default_value = Py_None; PyObject *namespaces = Py_None; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|OO:findtext", _keywords, - &path, &default_value, &namespaces)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &path, &default_value, &namespaces)) { goto exit; + } return_value = _elementtree_Element_findtext_impl(self, path, default_value, namespaces); exit: @@ -204,13 +210,15 @@ static PyObject * _elementtree_Element_findall(ElementObject *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", "namespaces", NULL}; + static const char * const _keywords[] = {"path", "namespaces", NULL}; + static _PyArg_Parser _parser = {"O|O:findall", _keywords, 0}; PyObject *path; PyObject *namespaces = Py_None; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O:findall", _keywords, - &path, &namespaces)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &path, &namespaces)) { goto exit; + } return_value = _elementtree_Element_findall_impl(self, path, namespaces); exit: @@ -233,13 +241,15 @@ static PyObject * _elementtree_Element_iterfind(ElementObject *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", "namespaces", NULL}; + static const char * const _keywords[] = {"path", "namespaces", NULL}; + static _PyArg_Parser _parser = {"O|O:iterfind", _keywords, 0}; PyObject *path; PyObject *namespaces = Py_None; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O:iterfind", _keywords, - &path, &namespaces)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &path, &namespaces)) { goto exit; + } return_value = _elementtree_Element_iterfind_impl(self, path, namespaces); exit: @@ -262,13 +272,15 @@ static PyObject * _elementtree_Element_get(ElementObject *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"key", "default", NULL}; + static const char * const _keywords[] = {"key", "default", NULL}; + static _PyArg_Parser _parser = {"O|O:get", _keywords, 0}; PyObject *key; PyObject *default_value = Py_None; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O:get", _keywords, - &key, &default_value)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &key, &default_value)) { goto exit; + } return_value = _elementtree_Element_get_impl(self, key, default_value); exit: @@ -307,12 +319,14 @@ static PyObject * _elementtree_Element_iter(ElementObject *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"tag", NULL}; + static const char * const _keywords[] = {"tag", NULL}; + static _PyArg_Parser _parser = {"|O:iter", _keywords, 0}; PyObject *tag = Py_None; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:iter", _keywords, - &tag)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &tag)) { goto exit; + } return_value = _elementtree_Element_iter_impl(self, tag); exit: @@ -356,8 +370,9 @@ _elementtree_Element_insert(ElementObject *self, PyObject *args) PyObject *subelement; if (!PyArg_ParseTuple(args, "nO!:insert", - &index, &Element_Type, &subelement)) + &index, &Element_Type, &subelement)) { goto exit; + } return_value = _elementtree_Element_insert_impl(self, index, subelement); exit: @@ -419,8 +434,9 @@ _elementtree_Element_makeelement(ElementObject *self, PyObject *args) if (!PyArg_UnpackTuple(args, "makeelement", 2, 2, - &tag, &attrib)) + &tag, &attrib)) { goto exit; + } return_value = _elementtree_Element_makeelement_impl(self, tag, attrib); exit: @@ -444,8 +460,9 @@ _elementtree_Element_remove(ElementObject *self, PyObject *arg) PyObject *return_value = NULL; PyObject *subelement; - if (!PyArg_Parse(arg, "O!:remove", &Element_Type, &subelement)) + if (!PyArg_Parse(arg, "O!:remove", &Element_Type, &subelement)) { goto exit; + } return_value = _elementtree_Element_remove_impl(self, subelement); exit: @@ -473,8 +490,9 @@ _elementtree_Element_set(ElementObject *self, PyObject *args) if (!PyArg_UnpackTuple(args, "set", 2, 2, - &key, &value)) + &key, &value)) { goto exit; + } return_value = _elementtree_Element_set_impl(self, key, value); exit: @@ -489,12 +507,14 @@ static int _elementtree_TreeBuilder___init__(PyObject *self, PyObject *args, PyObject *kwargs) { int return_value = -1; - static char *_keywords[] = {"element_factory", NULL}; + static const char * const _keywords[] = {"element_factory", NULL}; + static _PyArg_Parser _parser = {"|O:TreeBuilder", _keywords, 0}; PyObject *element_factory = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:TreeBuilder", _keywords, - &element_factory)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &element_factory)) { goto exit; + } return_value = _elementtree_TreeBuilder___init___impl((TreeBuilderObject *)self, element_factory); exit: @@ -555,8 +575,9 @@ _elementtree_TreeBuilder_start(TreeBuilderObject *self, PyObject *args) if (!PyArg_UnpackTuple(args, "start", 1, 2, - &tag, &attrs)) + &tag, &attrs)) { goto exit; + } return_value = _elementtree_TreeBuilder_start_impl(self, tag, attrs); exit: @@ -571,14 +592,16 @@ static int _elementtree_XMLParser___init__(PyObject *self, PyObject *args, PyObject *kwargs) { int return_value = -1; - static char *_keywords[] = {"html", "target", "encoding", NULL}; + static const char * const _keywords[] = {"html", "target", "encoding", NULL}; + static _PyArg_Parser _parser = {"|OOz:XMLParser", _keywords, 0}; PyObject *html = NULL; PyObject *target = NULL; const char *encoding = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OOz:XMLParser", _keywords, - &html, &target, &encoding)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &html, &target, &encoding)) { goto exit; + } return_value = _elementtree_XMLParser___init___impl((XMLParserObject *)self, html, target, encoding); exit: @@ -640,8 +663,9 @@ _elementtree_XMLParser_doctype(XMLParserObject *self, PyObject *args) if (!PyArg_UnpackTuple(args, "doctype", 3, 3, - &name, &pubid, &system)) + &name, &pubid, &system)) { goto exit; + } return_value = _elementtree_XMLParser_doctype_impl(self, name, pubid, system); exit: @@ -668,12 +692,14 @@ _elementtree_XMLParser__setevents(XMLParserObject *self, PyObject *args) PyObject *events_queue; PyObject *events_to_report = Py_None; - if (!PyArg_ParseTuple(args, "O!|O:_setevents", - &PyList_Type, &events_queue, &events_to_report)) + if (!PyArg_UnpackTuple(args, "_setevents", + 1, 2, + &events_queue, &events_to_report)) { goto exit; + } return_value = _elementtree_XMLParser__setevents_impl(self, events_queue, events_to_report); exit: return return_value; } -/*[clinic end generated code: output=25b8bf7e7f2151ca input=a9049054013a1b77]*/ +/*[clinic end generated code: output=4c5e94c28a009ce6 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_gdbmmodule.c.h b/Modules/clinic/_gdbmmodule.c.h index 2d87cfc..fdd589c 100644 --- a/Modules/clinic/_gdbmmodule.c.h +++ b/Modules/clinic/_gdbmmodule.c.h @@ -23,8 +23,9 @@ _gdbm_gdbm_get(dbmobject *self, PyObject *args) if (!PyArg_UnpackTuple(args, "get", 1, 2, - &key, &default_value)) + &key, &default_value)) { goto exit; + } return_value = _gdbm_gdbm_get_impl(self, key, default_value); exit: @@ -53,8 +54,9 @@ _gdbm_gdbm_setdefault(dbmobject *self, PyObject *args) if (!PyArg_UnpackTuple(args, "setdefault", 1, 2, - &key, &default_value)) + &key, &default_value)) { goto exit; + } return_value = _gdbm_gdbm_setdefault_impl(self, key, default_value); exit: @@ -147,8 +149,9 @@ _gdbm_gdbm_nextkey(dbmobject *self, PyObject *arg) const char *key; Py_ssize_clean_t key_length; - if (!PyArg_Parse(arg, "s#:nextkey", &key, &key_length)) + if (!PyArg_Parse(arg, "s#:nextkey", &key, &key_length)) { goto exit; + } return_value = _gdbm_gdbm_nextkey_impl(self, key, key_length); exit: @@ -242,11 +245,12 @@ dbmopen(PyObject *module, PyObject *args) int mode = 438; if (!PyArg_ParseTuple(args, "s|si:open", - &name, &flags, &mode)) + &name, &flags, &mode)) { goto exit; + } return_value = dbmopen_impl(module, name, flags, mode); exit: return return_value; } -/*[clinic end generated code: output=9ac7a89858a9765f input=a9049054013a1b77]*/ +/*[clinic end generated code: output=ed0f5d4e3d79b80c input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_lzmamodule.c.h b/Modules/clinic/_lzmamodule.c.h index f8d38ea..c2ac89a 100644 --- a/Modules/clinic/_lzmamodule.c.h +++ b/Modules/clinic/_lzmamodule.c.h @@ -25,14 +25,16 @@ _lzma_LZMACompressor_compress(Compressor *self, PyObject *arg) PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:compress", &data)) + if (!PyArg_Parse(arg, "y*:compress", &data)) { goto exit; + } return_value = _lzma_LZMACompressor_compress_impl(self, &data); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -89,19 +91,22 @@ static PyObject * _lzma_LZMADecompressor_decompress(Decompressor *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"data", "max_length", NULL}; + static const char * const _keywords[] = {"data", "max_length", NULL}; + static _PyArg_Parser _parser = {"y*|n:decompress", _keywords, 0}; Py_buffer data = {NULL, NULL}; Py_ssize_t max_length = -1; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "y*|n:decompress", _keywords, - &data, &max_length)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &data, &max_length)) { goto exit; + } return_value = _lzma_LZMADecompressor_decompress_impl(self, &data, max_length); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -137,14 +142,16 @@ static int _lzma_LZMADecompressor___init__(PyObject *self, PyObject *args, PyObject *kwargs) { int return_value = -1; - static char *_keywords[] = {"format", "memlimit", "filters", NULL}; + static const char * const _keywords[] = {"format", "memlimit", "filters", NULL}; + static _PyArg_Parser _parser = {"|iOO:LZMADecompressor", _keywords, 0}; int format = FORMAT_AUTO; PyObject *memlimit = Py_None; PyObject *filters = Py_None; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|iOO:LZMADecompressor", _keywords, - &format, &memlimit, &filters)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &format, &memlimit, &filters)) { goto exit; + } return_value = _lzma_LZMADecompressor___init___impl((Decompressor *)self, format, memlimit, filters); exit: @@ -171,8 +178,9 @@ _lzma_is_check_supported(PyObject *module, PyObject *arg) PyObject *return_value = NULL; int check_id; - if (!PyArg_Parse(arg, "i:is_check_supported", &check_id)) + if (!PyArg_Parse(arg, "i:is_check_supported", &check_id)) { goto exit; + } return_value = _lzma_is_check_supported_impl(module, check_id); exit: @@ -199,8 +207,9 @@ _lzma__encode_filter_properties(PyObject *module, PyObject *arg) PyObject *return_value = NULL; lzma_filter filter = {LZMA_VLI_UNKNOWN, NULL}; - if (!PyArg_Parse(arg, "O&:_encode_filter_properties", lzma_filter_converter, &filter)) + if (!PyArg_Parse(arg, "O&:_encode_filter_properties", lzma_filter_converter, &filter)) { goto exit; + } return_value = _lzma__encode_filter_properties_impl(module, filter); exit: @@ -234,15 +243,17 @@ _lzma__decode_filter_properties(PyObject *module, PyObject *args) Py_buffer encoded_props = {NULL, NULL}; if (!PyArg_ParseTuple(args, "O&y*:_decode_filter_properties", - lzma_vli_converter, &filter_id, &encoded_props)) + lzma_vli_converter, &filter_id, &encoded_props)) { goto exit; + } return_value = _lzma__decode_filter_properties_impl(module, filter_id, &encoded_props); exit: /* Cleanup for encoded_props */ - if (encoded_props.obj) + if (encoded_props.obj) { PyBuffer_Release(&encoded_props); + } return return_value; } -/*[clinic end generated code: output=fada06020fd318cc input=a9049054013a1b77]*/ +/*[clinic end generated code: output=9434583fe111c771 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_opcode.c.h b/Modules/clinic/_opcode.c.h index a5f6442..513cbfd 100644 --- a/Modules/clinic/_opcode.c.h +++ b/Modules/clinic/_opcode.c.h @@ -23,14 +23,16 @@ _opcode_stack_effect(PyObject *module, PyObject *args) int _return_value; if (!PyArg_ParseTuple(args, "i|O:stack_effect", - &opcode, &oparg)) + &opcode, &oparg)) { goto exit; + } _return_value = _opcode_stack_effect_impl(module, opcode, oparg); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong((long)_return_value); exit: return return_value; } -/*[clinic end generated code: output=984d6de140303d10 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=4d91c6a765097853 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_pickle.c.h b/Modules/clinic/_pickle.c.h index bd12d2a..b8eec33 100644 --- a/Modules/clinic/_pickle.c.h +++ b/Modules/clinic/_pickle.c.h @@ -53,8 +53,9 @@ _pickle_Pickler___sizeof__(PicklerObject *self, PyObject *Py_UNUSED(ignored)) Py_ssize_t _return_value; _return_value = _pickle_Pickler___sizeof___impl(self); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromSsize_t(_return_value); exit: @@ -92,14 +93,16 @@ static int _pickle_Pickler___init__(PyObject *self, PyObject *args, PyObject *kwargs) { int return_value = -1; - static char *_keywords[] = {"file", "protocol", "fix_imports", NULL}; + static const char * const _keywords[] = {"file", "protocol", "fix_imports", NULL}; + static _PyArg_Parser _parser = {"O|Op:Pickler", _keywords, 0}; PyObject *file; PyObject *protocol = NULL; int fix_imports = 1; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|Op:Pickler", _keywords, - &file, &protocol, &fix_imports)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &file, &protocol, &fix_imports)) { goto exit; + } return_value = _pickle_Pickler___init___impl((PicklerObject *)self, file, protocol, fix_imports); exit: @@ -212,8 +215,9 @@ _pickle_Unpickler_find_class(UnpicklerObject *self, PyObject *args) if (!PyArg_UnpackTuple(args, "find_class", 2, 2, - &module_name, &global_name)) + &module_name, &global_name)) { goto exit; + } return_value = _pickle_Unpickler_find_class_impl(self, module_name, global_name); exit: @@ -239,8 +243,9 @@ _pickle_Unpickler___sizeof__(UnpicklerObject *self, PyObject *Py_UNUSED(ignored) Py_ssize_t _return_value; _return_value = _pickle_Unpickler___sizeof___impl(self); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromSsize_t(_return_value); exit: @@ -281,15 +286,17 @@ static int _pickle_Unpickler___init__(PyObject *self, PyObject *args, PyObject *kwargs) { int return_value = -1; - static char *_keywords[] = {"file", "fix_imports", "encoding", "errors", NULL}; + static const char * const _keywords[] = {"file", "fix_imports", "encoding", "errors", NULL}; + static _PyArg_Parser _parser = {"O|$pss:Unpickler", _keywords, 0}; PyObject *file; int fix_imports = 1; const char *encoding = "ASCII"; const char *errors = "strict"; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|$pss:Unpickler", _keywords, - &file, &fix_imports, &encoding, &errors)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &file, &fix_imports, &encoding, &errors)) { goto exit; + } return_value = _pickle_Unpickler___init___impl((UnpicklerObject *)self, file, fix_imports, encoding, errors); exit: @@ -387,15 +394,17 @@ static PyObject * _pickle_dump(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"obj", "file", "protocol", "fix_imports", NULL}; + static const char * const _keywords[] = {"obj", "file", "protocol", "fix_imports", NULL}; + static _PyArg_Parser _parser = {"OO|O$p:dump", _keywords, 0}; PyObject *obj; PyObject *file; PyObject *protocol = NULL; int fix_imports = 1; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|O$p:dump", _keywords, - &obj, &file, &protocol, &fix_imports)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &obj, &file, &protocol, &fix_imports)) { goto exit; + } return_value = _pickle_dump_impl(module, obj, file, protocol, fix_imports); exit: @@ -431,14 +440,16 @@ static PyObject * _pickle_dumps(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"obj", "protocol", "fix_imports", NULL}; + static const char * const _keywords[] = {"obj", "protocol", "fix_imports", NULL}; + static _PyArg_Parser _parser = {"O|O$p:dumps", _keywords, 0}; PyObject *obj; PyObject *protocol = NULL; int fix_imports = 1; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O$p:dumps", _keywords, - &obj, &protocol, &fix_imports)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &obj, &protocol, &fix_imports)) { goto exit; + } return_value = _pickle_dumps_impl(module, obj, protocol, fix_imports); exit: @@ -485,15 +496,17 @@ static PyObject * _pickle_load(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"file", "fix_imports", "encoding", "errors", NULL}; + static const char * const _keywords[] = {"file", "fix_imports", "encoding", "errors", NULL}; + static _PyArg_Parser _parser = {"O|$pss:load", _keywords, 0}; PyObject *file; int fix_imports = 1; const char *encoding = "ASCII"; const char *errors = "strict"; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|$pss:load", _keywords, - &file, &fix_imports, &encoding, &errors)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &file, &fix_imports, &encoding, &errors)) { goto exit; + } return_value = _pickle_load_impl(module, file, fix_imports, encoding, errors); exit: @@ -531,18 +544,20 @@ static PyObject * _pickle_loads(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"data", "fix_imports", "encoding", "errors", NULL}; + static const char * const _keywords[] = {"data", "fix_imports", "encoding", "errors", NULL}; + static _PyArg_Parser _parser = {"O|$pss:loads", _keywords, 0}; PyObject *data; int fix_imports = 1; const char *encoding = "ASCII"; const char *errors = "strict"; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|$pss:loads", _keywords, - &data, &fix_imports, &encoding, &errors)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &data, &fix_imports, &encoding, &errors)) { goto exit; + } return_value = _pickle_loads_impl(module, data, fix_imports, encoding, errors); exit: return return_value; } -/*[clinic end generated code: output=93657e55d6a748af input=a9049054013a1b77]*/ +/*[clinic end generated code: output=50f9127109673c98 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_sre.c.h b/Modules/clinic/_sre.c.h index 3281717..9aba13e 100644 --- a/Modules/clinic/_sre.c.h +++ b/Modules/clinic/_sre.c.h @@ -20,8 +20,9 @@ _sre_getcodesize(PyObject *module, PyObject *Py_UNUSED(ignored)) int _return_value; _return_value = _sre_getcodesize_impl(module); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong((long)_return_value); exit: @@ -48,11 +49,13 @@ _sre_getlower(PyObject *module, PyObject *args) int _return_value; if (!PyArg_ParseTuple(args, "ii:getlower", - &character, &flags)) + &character, &flags)) { goto exit; + } _return_value = _sre_getlower_impl(module, character, flags); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong((long)_return_value); exit: @@ -77,15 +80,17 @@ static PyObject * _sre_SRE_Pattern_match(PatternObject *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"string", "pos", "endpos", "pattern", NULL}; + static const char * const _keywords[] = {"string", "pos", "endpos", "pattern", NULL}; + static _PyArg_Parser _parser = {"|Onn$O:match", _keywords, 0}; PyObject *string = NULL; Py_ssize_t pos = 0; Py_ssize_t endpos = PY_SSIZE_T_MAX; PyObject *pattern = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Onn$O:match", _keywords, - &string, &pos, &endpos, &pattern)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &string, &pos, &endpos, &pattern)) { goto exit; + } return_value = _sre_SRE_Pattern_match_impl(self, string, pos, endpos, pattern); exit: @@ -111,15 +116,17 @@ static PyObject * _sre_SRE_Pattern_fullmatch(PatternObject *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"string", "pos", "endpos", "pattern", NULL}; + static const char * const _keywords[] = {"string", "pos", "endpos", "pattern", NULL}; + static _PyArg_Parser _parser = {"|Onn$O:fullmatch", _keywords, 0}; PyObject *string = NULL; Py_ssize_t pos = 0; Py_ssize_t endpos = PY_SSIZE_T_MAX; PyObject *pattern = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Onn$O:fullmatch", _keywords, - &string, &pos, &endpos, &pattern)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &string, &pos, &endpos, &pattern)) { goto exit; + } return_value = _sre_SRE_Pattern_fullmatch_impl(self, string, pos, endpos, pattern); exit: @@ -147,15 +154,17 @@ static PyObject * _sre_SRE_Pattern_search(PatternObject *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"string", "pos", "endpos", "pattern", NULL}; + static const char * const _keywords[] = {"string", "pos", "endpos", "pattern", NULL}; + static _PyArg_Parser _parser = {"|Onn$O:search", _keywords, 0}; PyObject *string = NULL; Py_ssize_t pos = 0; Py_ssize_t endpos = PY_SSIZE_T_MAX; PyObject *pattern = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Onn$O:search", _keywords, - &string, &pos, &endpos, &pattern)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &string, &pos, &endpos, &pattern)) { goto exit; + } return_value = _sre_SRE_Pattern_search_impl(self, string, pos, endpos, pattern); exit: @@ -181,15 +190,17 @@ static PyObject * _sre_SRE_Pattern_findall(PatternObject *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"string", "pos", "endpos", "source", NULL}; + static const char * const _keywords[] = {"string", "pos", "endpos", "source", NULL}; + static _PyArg_Parser _parser = {"|Onn$O:findall", _keywords, 0}; PyObject *string = NULL; Py_ssize_t pos = 0; Py_ssize_t endpos = PY_SSIZE_T_MAX; PyObject *source = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Onn$O:findall", _keywords, - &string, &pos, &endpos, &source)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &string, &pos, &endpos, &source)) { goto exit; + } return_value = _sre_SRE_Pattern_findall_impl(self, string, pos, endpos, source); exit: @@ -215,14 +226,16 @@ static PyObject * _sre_SRE_Pattern_finditer(PatternObject *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"string", "pos", "endpos", NULL}; + static const char * const _keywords[] = {"string", "pos", "endpos", NULL}; + static _PyArg_Parser _parser = {"O|nn:finditer", _keywords, 0}; PyObject *string; Py_ssize_t pos = 0; Py_ssize_t endpos = PY_SSIZE_T_MAX; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|nn:finditer", _keywords, - &string, &pos, &endpos)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &string, &pos, &endpos)) { goto exit; + } return_value = _sre_SRE_Pattern_finditer_impl(self, string, pos, endpos); exit: @@ -245,14 +258,16 @@ static PyObject * _sre_SRE_Pattern_scanner(PatternObject *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"string", "pos", "endpos", NULL}; + static const char * const _keywords[] = {"string", "pos", "endpos", NULL}; + static _PyArg_Parser _parser = {"O|nn:scanner", _keywords, 0}; PyObject *string; Py_ssize_t pos = 0; Py_ssize_t endpos = PY_SSIZE_T_MAX; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|nn:scanner", _keywords, - &string, &pos, &endpos)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &string, &pos, &endpos)) { goto exit; + } return_value = _sre_SRE_Pattern_scanner_impl(self, string, pos, endpos); exit: @@ -276,14 +291,16 @@ static PyObject * _sre_SRE_Pattern_split(PatternObject *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"string", "maxsplit", "source", NULL}; + static const char * const _keywords[] = {"string", "maxsplit", "source", NULL}; + static _PyArg_Parser _parser = {"|On$O:split", _keywords, 0}; PyObject *string = NULL; Py_ssize_t maxsplit = 0; PyObject *source = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|On$O:split", _keywords, - &string, &maxsplit, &source)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &string, &maxsplit, &source)) { goto exit; + } return_value = _sre_SRE_Pattern_split_impl(self, string, maxsplit, source); exit: @@ -307,14 +324,16 @@ static PyObject * _sre_SRE_Pattern_sub(PatternObject *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"repl", "string", "count", NULL}; + static const char * const _keywords[] = {"repl", "string", "count", NULL}; + static _PyArg_Parser _parser = {"OO|n:sub", _keywords, 0}; PyObject *repl; PyObject *string; Py_ssize_t count = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|n:sub", _keywords, - &repl, &string, &count)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &repl, &string, &count)) { goto exit; + } return_value = _sre_SRE_Pattern_sub_impl(self, repl, string, count); exit: @@ -338,14 +357,16 @@ static PyObject * _sre_SRE_Pattern_subn(PatternObject *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"repl", "string", "count", NULL}; + static const char * const _keywords[] = {"repl", "string", "count", NULL}; + static _PyArg_Parser _parser = {"OO|n:subn", _keywords, 0}; PyObject *repl; PyObject *string; Py_ssize_t count = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|n:subn", _keywords, - &repl, &string, &count)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &repl, &string, &count)) { goto exit; + } return_value = _sre_SRE_Pattern_subn_impl(self, repl, string, count); exit: @@ -384,12 +405,14 @@ static PyObject * _sre_SRE_Pattern___deepcopy__(PatternObject *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"memo", NULL}; + static const char * const _keywords[] = {"memo", NULL}; + static _PyArg_Parser _parser = {"O:__deepcopy__", _keywords, 0}; PyObject *memo; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:__deepcopy__", _keywords, - &memo)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &memo)) { goto exit; + } return_value = _sre_SRE_Pattern___deepcopy___impl(self, memo); exit: @@ -414,7 +437,8 @@ static PyObject * _sre_compile(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"pattern", "flags", "code", "groups", "groupindex", "indexgroup", NULL}; + static const char * const _keywords[] = {"pattern", "flags", "code", "groups", "groupindex", "indexgroup", NULL}; + static _PyArg_Parser _parser = {"OiO!nOO:compile", _keywords, 0}; PyObject *pattern; int flags; PyObject *code; @@ -422,9 +446,10 @@ _sre_compile(PyObject *module, PyObject *args, PyObject *kwargs) PyObject *groupindex; PyObject *indexgroup; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO!nOO:compile", _keywords, - &pattern, &flags, &PyList_Type, &code, &groups, &groupindex, &indexgroup)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &pattern, &flags, &PyList_Type, &code, &groups, &groupindex, &indexgroup)) { goto exit; + } return_value = _sre_compile_impl(module, pattern, flags, code, groups, groupindex, indexgroup); exit: @@ -447,12 +472,14 @@ static PyObject * _sre_SRE_Match_expand(MatchObject *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"template", NULL}; + static const char * const _keywords[] = {"template", NULL}; + static _PyArg_Parser _parser = {"O:expand", _keywords, 0}; PyObject *template; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:expand", _keywords, - &template)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &template)) { goto exit; + } return_value = _sre_SRE_Match_expand_impl(self, template); exit: @@ -478,12 +505,14 @@ static PyObject * _sre_SRE_Match_groups(MatchObject *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"default", NULL}; + static const char * const _keywords[] = {"default", NULL}; + static _PyArg_Parser _parser = {"|O:groups", _keywords, 0}; PyObject *default_value = Py_None; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:groups", _keywords, - &default_value)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &default_value)) { goto exit; + } return_value = _sre_SRE_Match_groups_impl(self, default_value); exit: @@ -509,12 +538,14 @@ static PyObject * _sre_SRE_Match_groupdict(MatchObject *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"default", NULL}; + static const char * const _keywords[] = {"default", NULL}; + static _PyArg_Parser _parser = {"|O:groupdict", _keywords, 0}; PyObject *default_value = Py_None; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:groupdict", _keywords, - &default_value)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &default_value)) { goto exit; + } return_value = _sre_SRE_Match_groupdict_impl(self, default_value); exit: @@ -542,11 +573,13 @@ _sre_SRE_Match_start(MatchObject *self, PyObject *args) if (!PyArg_UnpackTuple(args, "start", 0, 1, - &group)) + &group)) { goto exit; + } _return_value = _sre_SRE_Match_start_impl(self, group); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromSsize_t(_return_value); exit: @@ -574,11 +607,13 @@ _sre_SRE_Match_end(MatchObject *self, PyObject *args) if (!PyArg_UnpackTuple(args, "end", 0, 1, - &group)) + &group)) { goto exit; + } _return_value = _sre_SRE_Match_end_impl(self, group); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromSsize_t(_return_value); exit: @@ -605,8 +640,9 @@ _sre_SRE_Match_span(MatchObject *self, PyObject *args) if (!PyArg_UnpackTuple(args, "span", 0, 1, - &group)) + &group)) { goto exit; + } return_value = _sre_SRE_Match_span_impl(self, group); exit: @@ -645,12 +681,14 @@ static PyObject * _sre_SRE_Match___deepcopy__(MatchObject *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"memo", NULL}; + static const char * const _keywords[] = {"memo", NULL}; + static _PyArg_Parser _parser = {"O:__deepcopy__", _keywords, 0}; PyObject *memo; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:__deepcopy__", _keywords, - &memo)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &memo)) { goto exit; + } return_value = _sre_SRE_Match___deepcopy___impl(self, memo); exit: @@ -690,4 +728,4 @@ _sre_SRE_Scanner_search(ScannerObject *self, PyObject *Py_UNUSED(ignored)) { return _sre_SRE_Scanner_search_impl(self); } -/*[clinic end generated code: output=a4ce9e5b748ce532 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=2cbc2b1482738e54 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_ssl.c.h b/Modules/clinic/_ssl.c.h index 852e365..0bdc35e 100644 --- a/Modules/clinic/_ssl.c.h +++ b/Modules/clinic/_ssl.c.h @@ -36,8 +36,9 @@ _ssl__test_decode_cert(PyObject *module, PyObject *arg) PyObject *return_value = NULL; PyObject *path; - if (!PyArg_Parse(arg, "O&:_test_decode_cert", PyUnicode_FSConverter, &path)) + if (!PyArg_Parse(arg, "O&:_test_decode_cert", PyUnicode_FSConverter, &path)) { goto exit; + } return_value = _ssl__test_decode_cert_impl(module, path); exit: @@ -71,8 +72,9 @@ _ssl__SSLSocket_peer_certificate(PySSLSocket *self, PyObject *args) int binary_mode = 0; if (!PyArg_ParseTuple(args, "|p:peer_certificate", - &binary_mode)) + &binary_mode)) { goto exit; + } return_value = _ssl__SSLSocket_peer_certificate_impl(self, binary_mode); exit: @@ -209,14 +211,16 @@ _ssl__SSLSocket_write(PySSLSocket *self, PyObject *arg) PyObject *return_value = NULL; Py_buffer b = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:write", &b)) + if (!PyArg_Parse(arg, "y*:write", &b)) { goto exit; + } return_value = _ssl__SSLSocket_write_impl(self, &b); exit: /* Cleanup for b */ - if (b.obj) + if (b.obj) { PyBuffer_Release(&b); + } return return_value; } @@ -260,12 +264,14 @@ _ssl__SSLSocket_read(PySSLSocket *self, PyObject *args) switch (PyTuple_GET_SIZE(args)) { case 1: - if (!PyArg_ParseTuple(args, "i:read", &len)) + if (!PyArg_ParseTuple(args, "i:read", &len)) { goto exit; + } break; case 2: - if (!PyArg_ParseTuple(args, "iw*:read", &len, &buffer)) + if (!PyArg_ParseTuple(args, "iw*:read", &len, &buffer)) { goto exit; + } group_right_1 = 1; break; default: @@ -276,8 +282,9 @@ _ssl__SSLSocket_read(PySSLSocket *self, PyObject *args) exit: /* Cleanup for buffer */ - if (buffer.obj) + if (buffer.obj) { PyBuffer_Release(&buffer); + } return return_value; } @@ -332,11 +339,13 @@ _ssl__SSLContext(PyTypeObject *type, PyObject *args, PyObject *kwargs) int proto_version; if ((type == &PySSLContext_Type) && - !_PyArg_NoKeywords("_SSLContext", kwargs)) + !_PyArg_NoKeywords("_SSLContext", kwargs)) { goto exit; + } if (!PyArg_ParseTuple(args, "i:_SSLContext", - &proto_version)) + &proto_version)) { goto exit; + } return_value = _ssl__SSLContext_impl(type, proto_version); exit: @@ -360,8 +369,9 @@ _ssl__SSLContext_set_ciphers(PySSLContext *self, PyObject *arg) PyObject *return_value = NULL; const char *cipherlist; - if (!PyArg_Parse(arg, "s:set_ciphers", &cipherlist)) + if (!PyArg_Parse(arg, "s:set_ciphers", &cipherlist)) { goto exit; + } return_value = _ssl__SSLContext_set_ciphers_impl(self, cipherlist); exit: @@ -386,14 +396,16 @@ _ssl__SSLContext__set_npn_protocols(PySSLContext *self, PyObject *arg) PyObject *return_value = NULL; Py_buffer protos = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:_set_npn_protocols", &protos)) + if (!PyArg_Parse(arg, "y*:_set_npn_protocols", &protos)) { goto exit; + } return_value = _ssl__SSLContext__set_npn_protocols_impl(self, &protos); exit: /* Cleanup for protos */ - if (protos.obj) + if (protos.obj) { PyBuffer_Release(&protos); + } return return_value; } @@ -416,14 +428,16 @@ _ssl__SSLContext__set_alpn_protocols(PySSLContext *self, PyObject *arg) PyObject *return_value = NULL; Py_buffer protos = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:_set_alpn_protocols", &protos)) + if (!PyArg_Parse(arg, "y*:_set_alpn_protocols", &protos)) { goto exit; + } return_value = _ssl__SSLContext__set_alpn_protocols_impl(self, &protos); exit: /* Cleanup for protos */ - if (protos.obj) + if (protos.obj) { PyBuffer_Release(&protos); + } return return_value; } @@ -444,14 +458,16 @@ static PyObject * _ssl__SSLContext_load_cert_chain(PySSLContext *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"certfile", "keyfile", "password", NULL}; + static const char * const _keywords[] = {"certfile", "keyfile", "password", NULL}; + static _PyArg_Parser _parser = {"O|OO:load_cert_chain", _keywords, 0}; PyObject *certfile; PyObject *keyfile = NULL; PyObject *password = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|OO:load_cert_chain", _keywords, - &certfile, &keyfile, &password)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &certfile, &keyfile, &password)) { goto exit; + } return_value = _ssl__SSLContext_load_cert_chain_impl(self, certfile, keyfile, password); exit: @@ -476,14 +492,16 @@ static PyObject * _ssl__SSLContext_load_verify_locations(PySSLContext *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"cafile", "capath", "cadata", NULL}; + static const char * const _keywords[] = {"cafile", "capath", "cadata", NULL}; + static _PyArg_Parser _parser = {"|OOO:load_verify_locations", _keywords, 0}; PyObject *cafile = NULL; PyObject *capath = NULL; PyObject *cadata = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OOO:load_verify_locations", _keywords, - &cafile, &capath, &cadata)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &cafile, &capath, &cadata)) { goto exit; + } return_value = _ssl__SSLContext_load_verify_locations_impl(self, cafile, capath, cadata); exit: @@ -514,14 +532,16 @@ static PyObject * _ssl__SSLContext__wrap_socket(PySSLContext *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"sock", "server_side", "server_hostname", NULL}; + static const char * const _keywords[] = {"sock", "server_side", "server_hostname", NULL}; + static _PyArg_Parser _parser = {"O!i|O:_wrap_socket", _keywords, 0}; PyObject *sock; int server_side; PyObject *hostname_obj = Py_None; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!i|O:_wrap_socket", _keywords, - PySocketModule.Sock_Type, &sock, &server_side, &hostname_obj)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + PySocketModule.Sock_Type, &sock, &server_side, &hostname_obj)) { goto exit; + } return_value = _ssl__SSLContext__wrap_socket_impl(self, sock, server_side, hostname_obj); exit: @@ -546,15 +566,17 @@ static PyObject * _ssl__SSLContext__wrap_bio(PySSLContext *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"incoming", "outgoing", "server_side", "server_hostname", NULL}; + static const char * const _keywords[] = {"incoming", "outgoing", "server_side", "server_hostname", NULL}; + static _PyArg_Parser _parser = {"O!O!i|O:_wrap_bio", _keywords, 0}; PySSLMemoryBIO *incoming; PySSLMemoryBIO *outgoing; int server_side; PyObject *hostname_obj = Py_None; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!O!i|O:_wrap_bio", _keywords, - &PySSLMemoryBIO_Type, &incoming, &PySSLMemoryBIO_Type, &outgoing, &server_side, &hostname_obj)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &PySSLMemoryBIO_Type, &incoming, &PySSLMemoryBIO_Type, &outgoing, &server_side, &hostname_obj)) { goto exit; + } return_value = _ssl__SSLContext__wrap_bio_impl(self, incoming, outgoing, server_side, hostname_obj); exit: @@ -666,12 +688,14 @@ static PyObject * _ssl__SSLContext_get_ca_certs(PySSLContext *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"binary_form", NULL}; + static const char * const _keywords[] = {"binary_form", NULL}; + static _PyArg_Parser _parser = {"|p:get_ca_certs", _keywords, 0}; int binary_form = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|p:get_ca_certs", _keywords, - &binary_form)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &binary_form)) { goto exit; + } return_value = _ssl__SSLContext_get_ca_certs_impl(self, binary_form); exit: @@ -687,11 +711,13 @@ _ssl_MemoryBIO(PyTypeObject *type, PyObject *args, PyObject *kwargs) PyObject *return_value = NULL; if ((type == &PySSLMemoryBIO_Type) && - !_PyArg_NoPositional("MemoryBIO", args)) + !_PyArg_NoPositional("MemoryBIO", args)) { goto exit; + } if ((type == &PySSLMemoryBIO_Type) && - !_PyArg_NoKeywords("MemoryBIO", kwargs)) + !_PyArg_NoKeywords("MemoryBIO", kwargs)) { goto exit; + } return_value = _ssl_MemoryBIO_impl(type); exit: @@ -722,8 +748,9 @@ _ssl_MemoryBIO_read(PySSLMemoryBIO *self, PyObject *args) int len = -1; if (!PyArg_ParseTuple(args, "|i:read", - &len)) + &len)) { goto exit; + } return_value = _ssl_MemoryBIO_read_impl(self, len); exit: @@ -750,14 +777,16 @@ _ssl_MemoryBIO_write(PySSLMemoryBIO *self, PyObject *arg) PyObject *return_value = NULL; Py_buffer b = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:write", &b)) + if (!PyArg_Parse(arg, "y*:write", &b)) { goto exit; + } return_value = _ssl_MemoryBIO_write_impl(self, &b); exit: /* Cleanup for b */ - if (b.obj) + if (b.obj) { PyBuffer_Release(&b); + } return return_value; } @@ -805,14 +834,16 @@ _ssl_RAND_add(PyObject *module, PyObject *args) double entropy; if (!PyArg_ParseTuple(args, "s*d:RAND_add", - &view, &entropy)) + &view, &entropy)) { goto exit; + } return_value = _ssl_RAND_add_impl(module, &view, entropy); exit: /* Cleanup for view */ - if (view.obj) + if (view.obj) { PyBuffer_Release(&view); + } return return_value; } @@ -835,8 +866,9 @@ _ssl_RAND_bytes(PyObject *module, PyObject *arg) PyObject *return_value = NULL; int n; - if (!PyArg_Parse(arg, "i:RAND_bytes", &n)) + if (!PyArg_Parse(arg, "i:RAND_bytes", &n)) { goto exit; + } return_value = _ssl_RAND_bytes_impl(module, n); exit: @@ -864,8 +896,9 @@ _ssl_RAND_pseudo_bytes(PyObject *module, PyObject *arg) PyObject *return_value = NULL; int n; - if (!PyArg_Parse(arg, "i:RAND_pseudo_bytes", &n)) + if (!PyArg_Parse(arg, "i:RAND_pseudo_bytes", &n)) { goto exit; + } return_value = _ssl_RAND_pseudo_bytes_impl(module, n); exit: @@ -916,8 +949,9 @@ _ssl_RAND_egd(PyObject *module, PyObject *arg) PyObject *return_value = NULL; PyObject *path; - if (!PyArg_Parse(arg, "O&:RAND_egd", PyUnicode_FSConverter, &path)) + if (!PyArg_Parse(arg, "O&:RAND_egd", PyUnicode_FSConverter, &path)) { goto exit; + } return_value = _ssl_RAND_egd_impl(module, path); exit: @@ -965,13 +999,15 @@ static PyObject * _ssl_txt2obj(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"txt", "name", NULL}; + static const char * const _keywords[] = {"txt", "name", NULL}; + static _PyArg_Parser _parser = {"s|p:txt2obj", _keywords, 0}; const char *txt; int name = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|p:txt2obj", _keywords, - &txt, &name)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &txt, &name)) { goto exit; + } return_value = _ssl_txt2obj_impl(module, txt, name); exit: @@ -996,8 +1032,9 @@ _ssl_nid2obj(PyObject *module, PyObject *arg) PyObject *return_value = NULL; int nid; - if (!PyArg_Parse(arg, "i:nid2obj", &nid)) + if (!PyArg_Parse(arg, "i:nid2obj", &nid)) { goto exit; + } return_value = _ssl_nid2obj_impl(module, nid); exit: @@ -1028,12 +1065,14 @@ static PyObject * _ssl_enum_certificates(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"store_name", NULL}; + static const char * const _keywords[] = {"store_name", NULL}; + static _PyArg_Parser _parser = {"s:enum_certificates", _keywords, 0}; const char *store_name; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:enum_certificates", _keywords, - &store_name)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &store_name)) { goto exit; + } return_value = _ssl_enum_certificates_impl(module, store_name); exit: @@ -1065,12 +1104,14 @@ static PyObject * _ssl_enum_crls(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"store_name", NULL}; + static const char * const _keywords[] = {"store_name", NULL}; + static _PyArg_Parser _parser = {"s:enum_crls", _keywords, 0}; const char *store_name; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:enum_crls", _keywords, - &store_name)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &store_name)) { goto exit; + } return_value = _ssl_enum_crls_impl(module, store_name); exit: @@ -1102,4 +1143,4 @@ exit: #ifndef _SSL_ENUM_CRLS_METHODDEF #define _SSL_ENUM_CRLS_METHODDEF #endif /* !defined(_SSL_ENUM_CRLS_METHODDEF) */ -/*[clinic end generated code: output=6fb10594d8351dc5 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=6057f95343369849 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_tkinter.c.h b/Modules/clinic/_tkinter.c.h index 77af083..edd5380 100644 --- a/Modules/clinic/_tkinter.c.h +++ b/Modules/clinic/_tkinter.c.h @@ -19,8 +19,9 @@ _tkinter_tkapp_eval(TkappObject *self, PyObject *arg) PyObject *return_value = NULL; const char *script; - if (!PyArg_Parse(arg, "s:eval", &script)) + if (!PyArg_Parse(arg, "s:eval", &script)) { goto exit; + } return_value = _tkinter_tkapp_eval_impl(self, script); exit: @@ -44,8 +45,9 @@ _tkinter_tkapp_evalfile(TkappObject *self, PyObject *arg) PyObject *return_value = NULL; const char *fileName; - if (!PyArg_Parse(arg, "s:evalfile", &fileName)) + if (!PyArg_Parse(arg, "s:evalfile", &fileName)) { goto exit; + } return_value = _tkinter_tkapp_evalfile_impl(self, fileName); exit: @@ -69,8 +71,9 @@ _tkinter_tkapp_record(TkappObject *self, PyObject *arg) PyObject *return_value = NULL; const char *script; - if (!PyArg_Parse(arg, "s:record", &script)) + if (!PyArg_Parse(arg, "s:record", &script)) { goto exit; + } return_value = _tkinter_tkapp_record_impl(self, script); exit: @@ -94,8 +97,9 @@ _tkinter_tkapp_adderrinfo(TkappObject *self, PyObject *arg) PyObject *return_value = NULL; const char *msg; - if (!PyArg_Parse(arg, "s:adderrinfo", &msg)) + if (!PyArg_Parse(arg, "s:adderrinfo", &msg)) { goto exit; + } return_value = _tkinter_tkapp_adderrinfo_impl(self, msg); exit: @@ -143,8 +147,9 @@ _tkinter_tkapp_exprstring(TkappObject *self, PyObject *arg) PyObject *return_value = NULL; const char *s; - if (!PyArg_Parse(arg, "s:exprstring", &s)) + if (!PyArg_Parse(arg, "s:exprstring", &s)) { goto exit; + } return_value = _tkinter_tkapp_exprstring_impl(self, s); exit: @@ -168,8 +173,9 @@ _tkinter_tkapp_exprlong(TkappObject *self, PyObject *arg) PyObject *return_value = NULL; const char *s; - if (!PyArg_Parse(arg, "s:exprlong", &s)) + if (!PyArg_Parse(arg, "s:exprlong", &s)) { goto exit; + } return_value = _tkinter_tkapp_exprlong_impl(self, s); exit: @@ -193,8 +199,9 @@ _tkinter_tkapp_exprdouble(TkappObject *self, PyObject *arg) PyObject *return_value = NULL; const char *s; - if (!PyArg_Parse(arg, "s:exprdouble", &s)) + if (!PyArg_Parse(arg, "s:exprdouble", &s)) { goto exit; + } return_value = _tkinter_tkapp_exprdouble_impl(self, s); exit: @@ -218,8 +225,9 @@ _tkinter_tkapp_exprboolean(TkappObject *self, PyObject *arg) PyObject *return_value = NULL; const char *s; - if (!PyArg_Parse(arg, "s:exprboolean", &s)) + if (!PyArg_Parse(arg, "s:exprboolean", &s)) { goto exit; + } return_value = _tkinter_tkapp_exprboolean_impl(self, s); exit: @@ -262,8 +270,9 @@ _tkinter_tkapp_createcommand(TkappObject *self, PyObject *args) PyObject *func; if (!PyArg_ParseTuple(args, "sO:createcommand", - &name, &func)) + &name, &func)) { goto exit; + } return_value = _tkinter_tkapp_createcommand_impl(self, name, func); exit: @@ -287,8 +296,9 @@ _tkinter_tkapp_deletecommand(TkappObject *self, PyObject *arg) PyObject *return_value = NULL; const char *name; - if (!PyArg_Parse(arg, "s:deletecommand", &name)) + if (!PyArg_Parse(arg, "s:deletecommand", &name)) { goto exit; + } return_value = _tkinter_tkapp_deletecommand_impl(self, name); exit: @@ -318,8 +328,9 @@ _tkinter_tkapp_createfilehandler(TkappObject *self, PyObject *args) PyObject *func; if (!PyArg_ParseTuple(args, "OiO:createfilehandler", - &file, &mask, &func)) + &file, &mask, &func)) { goto exit; + } return_value = _tkinter_tkapp_createfilehandler_impl(self, file, mask, func); exit: @@ -377,8 +388,9 @@ _tkinter_tkapp_createtimerhandler(TkappObject *self, PyObject *args) PyObject *func; if (!PyArg_ParseTuple(args, "iO:createtimerhandler", - &milliseconds, &func)) + &milliseconds, &func)) { goto exit; + } return_value = _tkinter_tkapp_createtimerhandler_impl(self, milliseconds, func); exit: @@ -403,8 +415,9 @@ _tkinter_tkapp_mainloop(TkappObject *self, PyObject *args) int threshold = 0; if (!PyArg_ParseTuple(args, "|i:mainloop", - &threshold)) + &threshold)) { goto exit; + } return_value = _tkinter_tkapp_mainloop_impl(self, threshold); exit: @@ -429,8 +442,9 @@ _tkinter_tkapp_dooneevent(TkappObject *self, PyObject *args) int flags = 0; if (!PyArg_ParseTuple(args, "|i:dooneevent", - &flags)) + &flags)) { goto exit; + } return_value = _tkinter_tkapp_dooneevent_impl(self, flags); exit: @@ -551,8 +565,9 @@ _tkinter_create(PyObject *module, PyObject *args) const char *use = NULL; if (!PyArg_ParseTuple(args, "|zssiiiiz:create", - &screenName, &baseName, &className, &interactive, &wantobjects, &wantTk, &sync, &use)) + &screenName, &baseName, &className, &interactive, &wantobjects, &wantTk, &sync, &use)) { goto exit; + } return_value = _tkinter_create_impl(module, screenName, baseName, className, interactive, wantobjects, wantTk, sync, use); exit: @@ -579,8 +594,9 @@ _tkinter_setbusywaitinterval(PyObject *module, PyObject *arg) PyObject *return_value = NULL; int new_val; - if (!PyArg_Parse(arg, "i:setbusywaitinterval", &new_val)) + if (!PyArg_Parse(arg, "i:setbusywaitinterval", &new_val)) { goto exit; + } return_value = _tkinter_setbusywaitinterval_impl(module, new_val); exit: @@ -606,8 +622,9 @@ _tkinter_getbusywaitinterval(PyObject *module, PyObject *Py_UNUSED(ignored)) int _return_value; _return_value = _tkinter_getbusywaitinterval_impl(module); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong((long)_return_value); exit: @@ -621,4 +638,4 @@ exit: #ifndef _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF #define _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF #endif /* !defined(_TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF) */ -/*[clinic end generated code: output=f9057c8bf288633d input=a9049054013a1b77]*/ +/*[clinic end generated code: output=836c578b71d69097 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_weakref.c.h b/Modules/clinic/_weakref.c.h index b83b33e..c192e72 100644 --- a/Modules/clinic/_weakref.c.h +++ b/Modules/clinic/_weakref.c.h @@ -21,11 +21,12 @@ _weakref_getweakrefcount(PyObject *module, PyObject *object) Py_ssize_t _return_value; _return_value = _weakref_getweakrefcount_impl(module, object); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromSsize_t(_return_value); exit: return return_value; } -/*[clinic end generated code: output=d9086c8576d46933 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=e1ad587147323e19 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_winapi.c.h b/Modules/clinic/_winapi.c.h index ac38d37..44d48a9 100644 --- a/Modules/clinic/_winapi.c.h +++ b/Modules/clinic/_winapi.c.h @@ -19,8 +19,9 @@ _winapi_Overlapped_GetOverlappedResult(OverlappedObject *self, PyObject *arg) PyObject *return_value = NULL; int wait; - if (!PyArg_Parse(arg, "p:GetOverlappedResult", &wait)) + if (!PyArg_Parse(arg, "p:GetOverlappedResult", &wait)) { goto exit; + } return_value = _winapi_Overlapped_GetOverlappedResult_impl(self, wait); exit: @@ -79,8 +80,9 @@ _winapi_CloseHandle(PyObject *module, PyObject *arg) PyObject *return_value = NULL; HANDLE handle; - if (!PyArg_Parse(arg, "" F_HANDLE ":CloseHandle", &handle)) + if (!PyArg_Parse(arg, "" F_HANDLE ":CloseHandle", &handle)) { goto exit; + } return_value = _winapi_CloseHandle_impl(module, handle); exit: @@ -103,13 +105,15 @@ static PyObject * _winapi_ConnectNamedPipe(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"handle", "overlapped", NULL}; + static const char * const _keywords[] = {"handle", "overlapped", NULL}; + static _PyArg_Parser _parser = {"" F_HANDLE "|i:ConnectNamedPipe", _keywords, 0}; HANDLE handle; int use_overlapped = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "" F_HANDLE "|i:ConnectNamedPipe", _keywords, - &handle, &use_overlapped)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &handle, &use_overlapped)) { goto exit; + } return_value = _winapi_ConnectNamedPipe_impl(module, handle, use_overlapped); exit: @@ -147,13 +151,16 @@ _winapi_CreateFile(PyObject *module, PyObject *args) HANDLE _return_value; if (!PyArg_ParseTuple(args, "skk" F_POINTER "kk" F_HANDLE ":CreateFile", - &file_name, &desired_access, &share_mode, &security_attributes, &creation_disposition, &flags_and_attributes, &template_file)) + &file_name, &desired_access, &share_mode, &security_attributes, &creation_disposition, &flags_and_attributes, &template_file)) { 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()) + if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) { goto exit; - if (_return_value == NULL) + } + if (_return_value == NULL) { Py_RETURN_NONE; + } return_value = HANDLE_TO_PYNUM(_return_value); exit: @@ -180,8 +187,9 @@ _winapi_CreateJunction(PyObject *module, PyObject *args) LPWSTR dst_path; if (!PyArg_ParseTuple(args, "uu:CreateJunction", - &src_path, &dst_path)) + &src_path, &dst_path)) { goto exit; + } return_value = _winapi_CreateJunction_impl(module, src_path, dst_path); exit: @@ -220,13 +228,16 @@ _winapi_CreateNamedPipe(PyObject *module, PyObject *args) HANDLE _return_value; if (!PyArg_ParseTuple(args, "skkkkkk" F_POINTER ":CreateNamedPipe", - &name, &open_mode, &pipe_mode, &max_instances, &out_buffer_size, &in_buffer_size, &default_timeout, &security_attributes)) + &name, &open_mode, &pipe_mode, &max_instances, &out_buffer_size, &in_buffer_size, &default_timeout, &security_attributes)) { 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()) + if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) { goto exit; - if (_return_value == NULL) + } + if (_return_value == NULL) { Py_RETURN_NONE; + } return_value = HANDLE_TO_PYNUM(_return_value); exit: @@ -258,8 +269,9 @@ _winapi_CreatePipe(PyObject *module, PyObject *args) DWORD size; if (!PyArg_ParseTuple(args, "Ok:CreatePipe", - &pipe_attrs, &size)) + &pipe_attrs, &size)) { goto exit; + } return_value = _winapi_CreatePipe_impl(module, pipe_attrs, size); exit: @@ -308,8 +320,9 @@ _winapi_CreateProcess(PyObject *module, PyObject *args) PyObject *startup_info; if (!PyArg_ParseTuple(args, "ZZOOikOZO:CreateProcess", - &application_name, &command_line, &proc_attrs, &thread_attrs, &inherit_handles, &creation_flags, &env_mapping, ¤t_directory, &startup_info)) + &application_name, &command_line, &proc_attrs, &thread_attrs, &inherit_handles, &creation_flags, &env_mapping, ¤t_directory, &startup_info)) { 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: @@ -351,13 +364,16 @@ _winapi_DuplicateHandle(PyObject *module, PyObject *args) HANDLE _return_value; if (!PyArg_ParseTuple(args, "" F_HANDLE "" F_HANDLE "" F_HANDLE "ki|k:DuplicateHandle", - &source_process_handle, &source_handle, &target_process_handle, &desired_access, &inherit_handle, &options)) + &source_process_handle, &source_handle, &target_process_handle, &desired_access, &inherit_handle, &options)) { 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()) + if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) { goto exit; - if (_return_value == NULL) + } + if (_return_value == NULL) { Py_RETURN_NONE; + } return_value = HANDLE_TO_PYNUM(_return_value); exit: @@ -381,8 +397,9 @@ _winapi_ExitProcess(PyObject *module, PyObject *arg) PyObject *return_value = NULL; UINT ExitCode; - if (!PyArg_Parse(arg, "I:ExitProcess", &ExitCode)) + if (!PyArg_Parse(arg, "I:ExitProcess", &ExitCode)) { goto exit; + } return_value = _winapi_ExitProcess_impl(module, ExitCode); exit: @@ -408,10 +425,12 @@ _winapi_GetCurrentProcess(PyObject *module, PyObject *Py_UNUSED(ignored)) HANDLE _return_value; _return_value = _winapi_GetCurrentProcess_impl(module); - if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) + if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) { goto exit; - if (_return_value == NULL) + } + if (_return_value == NULL) { Py_RETURN_NONE; + } return_value = HANDLE_TO_PYNUM(_return_value); exit: @@ -437,11 +456,13 @@ _winapi_GetExitCodeProcess(PyObject *module, PyObject *arg) HANDLE process; DWORD _return_value; - if (!PyArg_Parse(arg, "" F_HANDLE ":GetExitCodeProcess", &process)) + if (!PyArg_Parse(arg, "" F_HANDLE ":GetExitCodeProcess", &process)) { goto exit; + } _return_value = _winapi_GetExitCodeProcess_impl(module, process); - if ((_return_value == DWORD_MAX) && PyErr_Occurred()) + if ((_return_value == DWORD_MAX) && PyErr_Occurred()) { goto exit; + } return_value = Py_BuildValue("k", _return_value); exit: @@ -466,8 +487,9 @@ _winapi_GetLastError(PyObject *module, PyObject *Py_UNUSED(ignored)) DWORD _return_value; _return_value = _winapi_GetLastError_impl(module); - if ((_return_value == DWORD_MAX) && PyErr_Occurred()) + if ((_return_value == DWORD_MAX) && PyErr_Occurred()) { goto exit; + } return_value = Py_BuildValue("k", _return_value); exit: @@ -499,8 +521,9 @@ _winapi_GetModuleFileName(PyObject *module, PyObject *arg) PyObject *return_value = NULL; HMODULE module_handle; - if (!PyArg_Parse(arg, "" F_HANDLE ":GetModuleFileName", &module_handle)) + if (!PyArg_Parse(arg, "" F_HANDLE ":GetModuleFileName", &module_handle)) { goto exit; + } return_value = _winapi_GetModuleFileName_impl(module, module_handle); exit: @@ -531,13 +554,16 @@ _winapi_GetStdHandle(PyObject *module, PyObject *arg) DWORD std_handle; HANDLE _return_value; - if (!PyArg_Parse(arg, "k:GetStdHandle", &std_handle)) + if (!PyArg_Parse(arg, "k:GetStdHandle", &std_handle)) { goto exit; + } _return_value = _winapi_GetStdHandle_impl(module, std_handle); - if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) + if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) { goto exit; - if (_return_value == NULL) + } + if (_return_value == NULL) { Py_RETURN_NONE; + } return_value = HANDLE_TO_PYNUM(_return_value); exit: @@ -563,8 +589,9 @@ _winapi_GetVersion(PyObject *module, PyObject *Py_UNUSED(ignored)) long _return_value; _return_value = _winapi_GetVersion_impl(module); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong(_return_value); exit: @@ -593,13 +620,16 @@ _winapi_OpenProcess(PyObject *module, PyObject *args) HANDLE _return_value; if (!PyArg_ParseTuple(args, "kik:OpenProcess", - &desired_access, &inherit_handle, &process_id)) + &desired_access, &inherit_handle, &process_id)) { goto exit; + } _return_value = _winapi_OpenProcess_impl(module, desired_access, inherit_handle, process_id); - if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) + if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) { goto exit; - if (_return_value == NULL) + } + if (_return_value == NULL) { Py_RETURN_NONE; + } return_value = HANDLE_TO_PYNUM(_return_value); exit: @@ -625,8 +655,9 @@ _winapi_PeekNamedPipe(PyObject *module, PyObject *args) int size = 0; if (!PyArg_ParseTuple(args, "" F_HANDLE "|i:PeekNamedPipe", - &handle, &size)) + &handle, &size)) { goto exit; + } return_value = _winapi_PeekNamedPipe_impl(module, handle, size); exit: @@ -649,14 +680,16 @@ static PyObject * _winapi_ReadFile(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"handle", "size", "overlapped", NULL}; + static const char * const _keywords[] = {"handle", "size", "overlapped", NULL}; + static _PyArg_Parser _parser = {"" F_HANDLE "i|i:ReadFile", _keywords, 0}; HANDLE handle; int size; int use_overlapped = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "" F_HANDLE "i|i:ReadFile", _keywords, - &handle, &size, &use_overlapped)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &handle, &size, &use_overlapped)) { goto exit; + } return_value = _winapi_ReadFile_impl(module, handle, size, use_overlapped); exit: @@ -688,8 +721,9 @@ _winapi_SetNamedPipeHandleState(PyObject *module, PyObject *args) PyObject *collect_data_timeout; if (!PyArg_ParseTuple(args, "" F_HANDLE "OOO:SetNamedPipeHandleState", - &named_pipe, &mode, &max_collection_count, &collect_data_timeout)) + &named_pipe, &mode, &max_collection_count, &collect_data_timeout)) { goto exit; + } return_value = _winapi_SetNamedPipeHandleState_impl(module, named_pipe, mode, max_collection_count, collect_data_timeout); exit: @@ -717,8 +751,9 @@ _winapi_TerminateProcess(PyObject *module, PyObject *args) UINT exit_code; if (!PyArg_ParseTuple(args, "" F_HANDLE "I:TerminateProcess", - &handle, &exit_code)) + &handle, &exit_code)) { goto exit; + } return_value = _winapi_TerminateProcess_impl(module, handle, exit_code); exit: @@ -744,8 +779,9 @@ _winapi_WaitNamedPipe(PyObject *module, PyObject *args) DWORD timeout; if (!PyArg_ParseTuple(args, "sk:WaitNamedPipe", - &name, &timeout)) + &name, &timeout)) { goto exit; + } return_value = _winapi_WaitNamedPipe_impl(module, name, timeout); exit: @@ -774,8 +810,9 @@ _winapi_WaitForMultipleObjects(PyObject *module, PyObject *args) DWORD milliseconds = INFINITE; if (!PyArg_ParseTuple(args, "Oi|k:WaitForMultipleObjects", - &handle_seq, &wait_flag, &milliseconds)) + &handle_seq, &wait_flag, &milliseconds)) { goto exit; + } return_value = _winapi_WaitForMultipleObjects_impl(module, handle_seq, wait_flag, milliseconds); exit: @@ -808,11 +845,13 @@ _winapi_WaitForSingleObject(PyObject *module, PyObject *args) long _return_value; if (!PyArg_ParseTuple(args, "" F_HANDLE "k:WaitForSingleObject", - &handle, &milliseconds)) + &handle, &milliseconds)) { goto exit; + } _return_value = _winapi_WaitForSingleObject_impl(module, handle, milliseconds); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong(_return_value); exit: @@ -835,17 +874,19 @@ static PyObject * _winapi_WriteFile(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"handle", "buffer", "overlapped", NULL}; + static const char * const _keywords[] = {"handle", "buffer", "overlapped", NULL}; + static _PyArg_Parser _parser = {"" F_HANDLE "O|i:WriteFile", _keywords, 0}; HANDLE handle; PyObject *buffer; int use_overlapped = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "" F_HANDLE "O|i:WriteFile", _keywords, - &handle, &buffer, &use_overlapped)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &handle, &buffer, &use_overlapped)) { goto exit; + } return_value = _winapi_WriteFile_impl(module, handle, buffer, use_overlapped); exit: return return_value; } -/*[clinic end generated code: output=a4c4b2a9fcb0bea1 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=4bfccfb32ab726e8 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/arraymodule.c.h b/Modules/clinic/arraymodule.c.h index 0c7061a..3b9fcda 100644 --- a/Modules/clinic/arraymodule.c.h +++ b/Modules/clinic/arraymodule.c.h @@ -77,8 +77,9 @@ array_array_pop(arrayobject *self, PyObject *args) Py_ssize_t i = -1; if (!PyArg_ParseTuple(args, "|n:pop", - &i)) + &i)) { goto exit; + } return_value = array_array_pop_impl(self, i); exit: @@ -114,8 +115,9 @@ array_array_insert(arrayobject *self, PyObject *args) PyObject *v; if (!PyArg_ParseTuple(args, "nO:insert", - &i, &v)) + &i, &v)) { goto exit; + } return_value = array_array_insert_impl(self, i, v); exit: @@ -211,8 +213,9 @@ array_array_fromfile(arrayobject *self, PyObject *args) Py_ssize_t n; if (!PyArg_ParseTuple(args, "On:fromfile", - &f, &n)) + &f, &n)) { goto exit; + } return_value = array_array_fromfile_impl(self, f, n); exit: @@ -275,14 +278,16 @@ array_array_fromstring(arrayobject *self, PyObject *arg) PyObject *return_value = NULL; Py_buffer buffer = {NULL, NULL}; - if (!PyArg_Parse(arg, "s*:fromstring", &buffer)) + if (!PyArg_Parse(arg, "s*:fromstring", &buffer)) { goto exit; + } return_value = array_array_fromstring_impl(self, &buffer); exit: /* Cleanup for buffer */ - if (buffer.obj) + if (buffer.obj) { PyBuffer_Release(&buffer); + } return return_value; } @@ -305,14 +310,16 @@ array_array_frombytes(arrayobject *self, PyObject *arg) PyObject *return_value = NULL; Py_buffer buffer = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:frombytes", &buffer)) + if (!PyArg_Parse(arg, "y*:frombytes", &buffer)) { goto exit; + } return_value = array_array_frombytes_impl(self, &buffer); exit: /* Cleanup for buffer */ - if (buffer.obj) + if (buffer.obj) { PyBuffer_Release(&buffer); + } return return_value; } @@ -379,8 +386,9 @@ array_array_fromunicode(arrayobject *self, PyObject *arg) Py_UNICODE *ustr; Py_ssize_clean_t ustr_length; - if (!PyArg_Parse(arg, "u#:fromunicode", &ustr, &ustr_length)) + if (!PyArg_Parse(arg, "u#:fromunicode", &ustr, &ustr_length)) { goto exit; + } return_value = array_array_fromunicode_impl(self, ustr, ustr_length); exit: @@ -453,8 +461,9 @@ array__array_reconstructor(PyObject *module, PyObject *args) PyObject *items; if (!PyArg_ParseTuple(args, "OCiO:_array_reconstructor", - &arraytype, &typecode, &mformat_code, &items)) + &arraytype, &typecode, &mformat_code, &items)) { goto exit; + } return_value = array__array_reconstructor_impl(module, arraytype, typecode, mformat_code, items); exit: @@ -496,4 +505,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=305df3f5796039e4 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=b2054fb764c8cc64 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/audioop.c.h b/Modules/clinic/audioop.c.h index 62e313b5..be4b718 100644 --- a/Modules/clinic/audioop.c.h +++ b/Modules/clinic/audioop.c.h @@ -24,14 +24,16 @@ audioop_getsample(PyObject *module, PyObject *args) Py_ssize_t index; if (!PyArg_ParseTuple(args, "y*in:getsample", - &fragment, &width, &index)) + &fragment, &width, &index)) { goto exit; + } return_value = audioop_getsample_impl(module, &fragment, width, index); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -56,14 +58,16 @@ audioop_max(PyObject *module, PyObject *args) int width; if (!PyArg_ParseTuple(args, "y*i:max", - &fragment, &width)) + &fragment, &width)) { goto exit; + } return_value = audioop_max_impl(module, &fragment, width); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -88,14 +92,16 @@ audioop_minmax(PyObject *module, PyObject *args) int width; if (!PyArg_ParseTuple(args, "y*i:minmax", - &fragment, &width)) + &fragment, &width)) { goto exit; + } return_value = audioop_minmax_impl(module, &fragment, width); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -120,14 +126,16 @@ audioop_avg(PyObject *module, PyObject *args) int width; if (!PyArg_ParseTuple(args, "y*i:avg", - &fragment, &width)) + &fragment, &width)) { goto exit; + } return_value = audioop_avg_impl(module, &fragment, width); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -152,14 +160,16 @@ audioop_rms(PyObject *module, PyObject *args) int width; if (!PyArg_ParseTuple(args, "y*i:rms", - &fragment, &width)) + &fragment, &width)) { goto exit; + } return_value = audioop_rms_impl(module, &fragment, width); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -185,17 +195,20 @@ audioop_findfit(PyObject *module, PyObject *args) Py_buffer reference = {NULL, NULL}; if (!PyArg_ParseTuple(args, "y*y*:findfit", - &fragment, &reference)) + &fragment, &reference)) { goto exit; + } return_value = audioop_findfit_impl(module, &fragment, &reference); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } /* Cleanup for reference */ - if (reference.obj) + if (reference.obj) { PyBuffer_Release(&reference); + } return return_value; } @@ -221,17 +234,20 @@ audioop_findfactor(PyObject *module, PyObject *args) Py_buffer reference = {NULL, NULL}; if (!PyArg_ParseTuple(args, "y*y*:findfactor", - &fragment, &reference)) + &fragment, &reference)) { goto exit; + } return_value = audioop_findfactor_impl(module, &fragment, &reference); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } /* Cleanup for reference */ - if (reference.obj) + if (reference.obj) { PyBuffer_Release(&reference); + } return return_value; } @@ -257,14 +273,16 @@ audioop_findmax(PyObject *module, PyObject *args) Py_ssize_t length; if (!PyArg_ParseTuple(args, "y*n:findmax", - &fragment, &length)) + &fragment, &length)) { goto exit; + } return_value = audioop_findmax_impl(module, &fragment, length); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -289,14 +307,16 @@ audioop_avgpp(PyObject *module, PyObject *args) int width; if (!PyArg_ParseTuple(args, "y*i:avgpp", - &fragment, &width)) + &fragment, &width)) { goto exit; + } return_value = audioop_avgpp_impl(module, &fragment, width); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -321,14 +341,16 @@ audioop_maxpp(PyObject *module, PyObject *args) int width; if (!PyArg_ParseTuple(args, "y*i:maxpp", - &fragment, &width)) + &fragment, &width)) { goto exit; + } return_value = audioop_maxpp_impl(module, &fragment, width); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -353,14 +375,16 @@ audioop_cross(PyObject *module, PyObject *args) int width; if (!PyArg_ParseTuple(args, "y*i:cross", - &fragment, &width)) + &fragment, &width)) { goto exit; + } return_value = audioop_cross_impl(module, &fragment, width); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -387,14 +411,16 @@ audioop_mul(PyObject *module, PyObject *args) double factor; if (!PyArg_ParseTuple(args, "y*id:mul", - &fragment, &width, &factor)) + &fragment, &width, &factor)) { goto exit; + } return_value = audioop_mul_impl(module, &fragment, width, factor); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -422,14 +448,16 @@ audioop_tomono(PyObject *module, PyObject *args) double rfactor; if (!PyArg_ParseTuple(args, "y*idd:tomono", - &fragment, &width, &lfactor, &rfactor)) + &fragment, &width, &lfactor, &rfactor)) { goto exit; + } return_value = audioop_tomono_impl(module, &fragment, width, lfactor, rfactor); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -457,14 +485,16 @@ audioop_tostereo(PyObject *module, PyObject *args) double rfactor; if (!PyArg_ParseTuple(args, "y*idd:tostereo", - &fragment, &width, &lfactor, &rfactor)) + &fragment, &width, &lfactor, &rfactor)) { goto exit; + } return_value = audioop_tostereo_impl(module, &fragment, width, lfactor, rfactor); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -491,17 +521,20 @@ audioop_add(PyObject *module, PyObject *args) int width; if (!PyArg_ParseTuple(args, "y*y*i:add", - &fragment1, &fragment2, &width)) + &fragment1, &fragment2, &width)) { goto exit; + } return_value = audioop_add_impl(module, &fragment1, &fragment2, width); exit: /* Cleanup for fragment1 */ - if (fragment1.obj) + if (fragment1.obj) { PyBuffer_Release(&fragment1); + } /* Cleanup for fragment2 */ - if (fragment2.obj) + if (fragment2.obj) { PyBuffer_Release(&fragment2); + } return return_value; } @@ -527,14 +560,16 @@ audioop_bias(PyObject *module, PyObject *args) int bias; if (!PyArg_ParseTuple(args, "y*ii:bias", - &fragment, &width, &bias)) + &fragment, &width, &bias)) { goto exit; + } return_value = audioop_bias_impl(module, &fragment, width, bias); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -559,14 +594,16 @@ audioop_reverse(PyObject *module, PyObject *args) int width; if (!PyArg_ParseTuple(args, "y*i:reverse", - &fragment, &width)) + &fragment, &width)) { goto exit; + } return_value = audioop_reverse_impl(module, &fragment, width); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -591,14 +628,16 @@ audioop_byteswap(PyObject *module, PyObject *args) int width; if (!PyArg_ParseTuple(args, "y*i:byteswap", - &fragment, &width)) + &fragment, &width)) { goto exit; + } return_value = audioop_byteswap_impl(module, &fragment, width); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -625,14 +664,16 @@ audioop_lin2lin(PyObject *module, PyObject *args) int newwidth; if (!PyArg_ParseTuple(args, "y*ii:lin2lin", - &fragment, &width, &newwidth)) + &fragment, &width, &newwidth)) { goto exit; + } return_value = audioop_lin2lin_impl(module, &fragment, width, newwidth); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -666,14 +707,16 @@ audioop_ratecv(PyObject *module, PyObject *args) int weightB = 0; if (!PyArg_ParseTuple(args, "y*iiiiO|ii:ratecv", - &fragment, &width, &nchannels, &inrate, &outrate, &state, &weightA, &weightB)) + &fragment, &width, &nchannels, &inrate, &outrate, &state, &weightA, &weightB)) { goto exit; + } return_value = audioop_ratecv_impl(module, &fragment, width, nchannels, inrate, outrate, state, weightA, weightB); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -698,14 +741,16 @@ audioop_lin2ulaw(PyObject *module, PyObject *args) int width; if (!PyArg_ParseTuple(args, "y*i:lin2ulaw", - &fragment, &width)) + &fragment, &width)) { goto exit; + } return_value = audioop_lin2ulaw_impl(module, &fragment, width); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -730,14 +775,16 @@ audioop_ulaw2lin(PyObject *module, PyObject *args) int width; if (!PyArg_ParseTuple(args, "y*i:ulaw2lin", - &fragment, &width)) + &fragment, &width)) { goto exit; + } return_value = audioop_ulaw2lin_impl(module, &fragment, width); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -762,14 +809,16 @@ audioop_lin2alaw(PyObject *module, PyObject *args) int width; if (!PyArg_ParseTuple(args, "y*i:lin2alaw", - &fragment, &width)) + &fragment, &width)) { goto exit; + } return_value = audioop_lin2alaw_impl(module, &fragment, width); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -794,14 +843,16 @@ audioop_alaw2lin(PyObject *module, PyObject *args) int width; if (!PyArg_ParseTuple(args, "y*i:alaw2lin", - &fragment, &width)) + &fragment, &width)) { goto exit; + } return_value = audioop_alaw2lin_impl(module, &fragment, width); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -828,14 +879,16 @@ audioop_lin2adpcm(PyObject *module, PyObject *args) PyObject *state; if (!PyArg_ParseTuple(args, "y*iO:lin2adpcm", - &fragment, &width, &state)) + &fragment, &width, &state)) { goto exit; + } return_value = audioop_lin2adpcm_impl(module, &fragment, width, state); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -862,15 +915,17 @@ audioop_adpcm2lin(PyObject *module, PyObject *args) PyObject *state; if (!PyArg_ParseTuple(args, "y*iO:adpcm2lin", - &fragment, &width, &state)) + &fragment, &width, &state)) { goto exit; + } return_value = audioop_adpcm2lin_impl(module, &fragment, width, state); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } -/*[clinic end generated code: output=385fb09fa21a62c0 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=e0ab74c3fa57c39c input=a9049054013a1b77]*/ diff --git a/Modules/clinic/binascii.c.h b/Modules/clinic/binascii.c.h index e20cac2..0ee7f57 100644 --- a/Modules/clinic/binascii.c.h +++ b/Modules/clinic/binascii.c.h @@ -20,8 +20,9 @@ binascii_a2b_uu(PyObject *module, PyObject *arg) PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (!PyArg_Parse(arg, "O&:a2b_uu", ascii_buffer_converter, &data)) + if (!PyArg_Parse(arg, "O&:a2b_uu", ascii_buffer_converter, &data)) { goto exit; + } return_value = binascii_a2b_uu_impl(module, &data); exit: @@ -50,14 +51,16 @@ binascii_b2a_uu(PyObject *module, PyObject *arg) PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:b2a_uu", &data)) + if (!PyArg_Parse(arg, "y*:b2a_uu", &data)) { goto exit; + } return_value = binascii_b2a_uu_impl(module, &data); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -80,8 +83,9 @@ binascii_a2b_base64(PyObject *module, PyObject *arg) PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (!PyArg_Parse(arg, "O&:a2b_base64", ascii_buffer_converter, &data)) + if (!PyArg_Parse(arg, "O&:a2b_base64", ascii_buffer_converter, &data)) { goto exit; + } return_value = binascii_a2b_base64_impl(module, &data); exit: @@ -93,31 +97,37 @@ exit: } PyDoc_STRVAR(binascii_b2a_base64__doc__, -"b2a_base64($module, data, /)\n" +"b2a_base64($module, /, data, *, newline=True)\n" "--\n" "\n" "Base64-code line of data."); #define BINASCII_B2A_BASE64_METHODDEF \ - {"b2a_base64", (PyCFunction)binascii_b2a_base64, METH_O, binascii_b2a_base64__doc__}, + {"b2a_base64", (PyCFunction)binascii_b2a_base64, METH_VARARGS|METH_KEYWORDS, binascii_b2a_base64__doc__}, static PyObject * -binascii_b2a_base64_impl(PyObject *module, Py_buffer *data); +binascii_b2a_base64_impl(PyObject *module, Py_buffer *data, int newline); static PyObject * -binascii_b2a_base64(PyObject *module, PyObject *arg) +binascii_b2a_base64(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; + static const char * const _keywords[] = {"data", "newline", NULL}; + static _PyArg_Parser _parser = {"y*|$i:b2a_base64", _keywords, 0}; Py_buffer data = {NULL, NULL}; + int newline = 1; - if (!PyArg_Parse(arg, "y*:b2a_base64", &data)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &data, &newline)) { goto exit; - return_value = binascii_b2a_base64_impl(module, &data); + } + return_value = binascii_b2a_base64_impl(module, &data, newline); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -140,8 +150,9 @@ binascii_a2b_hqx(PyObject *module, PyObject *arg) PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (!PyArg_Parse(arg, "O&:a2b_hqx", ascii_buffer_converter, &data)) + if (!PyArg_Parse(arg, "O&:a2b_hqx", ascii_buffer_converter, &data)) { goto exit; + } return_value = binascii_a2b_hqx_impl(module, &data); exit: @@ -170,14 +181,16 @@ binascii_rlecode_hqx(PyObject *module, PyObject *arg) PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:rlecode_hqx", &data)) + if (!PyArg_Parse(arg, "y*:rlecode_hqx", &data)) { goto exit; + } return_value = binascii_rlecode_hqx_impl(module, &data); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -200,14 +213,16 @@ binascii_b2a_hqx(PyObject *module, PyObject *arg) PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:b2a_hqx", &data)) + if (!PyArg_Parse(arg, "y*:b2a_hqx", &data)) { goto exit; + } return_value = binascii_b2a_hqx_impl(module, &data); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -230,14 +245,16 @@ binascii_rledecode_hqx(PyObject *module, PyObject *arg) PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:rledecode_hqx", &data)) + if (!PyArg_Parse(arg, "y*:rledecode_hqx", &data)) { goto exit; + } return_value = binascii_rledecode_hqx_impl(module, &data); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -263,17 +280,20 @@ binascii_crc_hqx(PyObject *module, PyObject *args) unsigned int _return_value; if (!PyArg_ParseTuple(args, "y*I:crc_hqx", - &data, &crc)) + &data, &crc)) { goto exit; + } _return_value = binascii_crc_hqx_impl(module, &data, crc); - if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) + if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromUnsignedLong((unsigned long)_return_value); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -299,17 +319,20 @@ binascii_crc32(PyObject *module, PyObject *args) unsigned int _return_value; if (!PyArg_ParseTuple(args, "y*|I:crc32", - &data, &crc)) + &data, &crc)) { goto exit; + } _return_value = binascii_crc32_impl(module, &data, crc); - if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) + if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromUnsignedLong((unsigned long)_return_value); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -335,14 +358,16 @@ binascii_b2a_hex(PyObject *module, PyObject *arg) PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:b2a_hex", &data)) + if (!PyArg_Parse(arg, "y*:b2a_hex", &data)) { goto exit; + } return_value = binascii_b2a_hex_impl(module, &data); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -367,14 +392,16 @@ binascii_hexlify(PyObject *module, PyObject *arg) PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:hexlify", &data)) + if (!PyArg_Parse(arg, "y*:hexlify", &data)) { goto exit; + } return_value = binascii_hexlify_impl(module, &data); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -400,8 +427,9 @@ binascii_a2b_hex(PyObject *module, PyObject *arg) PyObject *return_value = NULL; Py_buffer hexstr = {NULL, NULL}; - if (!PyArg_Parse(arg, "O&:a2b_hex", ascii_buffer_converter, &hexstr)) + if (!PyArg_Parse(arg, "O&:a2b_hex", ascii_buffer_converter, &hexstr)) { goto exit; + } return_value = binascii_a2b_hex_impl(module, &hexstr); exit: @@ -432,8 +460,9 @@ binascii_unhexlify(PyObject *module, PyObject *arg) PyObject *return_value = NULL; Py_buffer hexstr = {NULL, NULL}; - if (!PyArg_Parse(arg, "O&:unhexlify", ascii_buffer_converter, &hexstr)) + if (!PyArg_Parse(arg, "O&:unhexlify", ascii_buffer_converter, &hexstr)) { goto exit; + } return_value = binascii_unhexlify_impl(module, &hexstr); exit: @@ -460,13 +489,15 @@ static PyObject * binascii_a2b_qp(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"data", "header", NULL}; + static const char * const _keywords[] = {"data", "header", NULL}; + static _PyArg_Parser _parser = {"O&|i:a2b_qp", _keywords, 0}; Py_buffer data = {NULL, NULL}; int header = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|i:a2b_qp", _keywords, - ascii_buffer_converter, &data, &header)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + ascii_buffer_converter, &data, &header)) { goto exit; + } return_value = binascii_a2b_qp_impl(module, &data, header); exit: @@ -498,22 +529,25 @@ static PyObject * binascii_b2a_qp(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"data", "quotetabs", "istext", "header", NULL}; + static const char * const _keywords[] = {"data", "quotetabs", "istext", "header", NULL}; + static _PyArg_Parser _parser = {"y*|iii:b2a_qp", _keywords, 0}; Py_buffer data = {NULL, NULL}; int quotetabs = 0; int istext = 1; int header = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "y*|iii:b2a_qp", _keywords, - &data, "etabs, &istext, &header)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &data, "etabs, &istext, &header)) { goto exit; + } return_value = binascii_b2a_qp_impl(module, &data, quotetabs, istext, header); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } -/*[clinic end generated code: output=51173fc9718a5edc input=a9049054013a1b77]*/ +/*[clinic end generated code: output=12611b05d8bf4a9c input=a9049054013a1b77]*/ diff --git a/Modules/clinic/cmathmodule.c.h b/Modules/clinic/cmathmodule.c.h index a255353..e46c314 100644 --- a/Modules/clinic/cmathmodule.c.h +++ b/Modules/clinic/cmathmodule.c.h @@ -21,8 +21,9 @@ cmath_acos(PyObject *module, PyObject *arg) Py_complex z; Py_complex _return_value; - if (!PyArg_Parse(arg, "D:acos", &z)) + if (!PyArg_Parse(arg, "D:acos", &z)) { goto exit; + } /* modifications for z */ errno = 0; PyFPE_START_PROTECT("complex function", goto exit); _return_value = cmath_acos_impl(module, z); @@ -62,8 +63,9 @@ cmath_acosh(PyObject *module, PyObject *arg) Py_complex z; Py_complex _return_value; - if (!PyArg_Parse(arg, "D:acosh", &z)) + if (!PyArg_Parse(arg, "D:acosh", &z)) { goto exit; + } /* modifications for z */ errno = 0; PyFPE_START_PROTECT("complex function", goto exit); _return_value = cmath_acosh_impl(module, z); @@ -103,8 +105,9 @@ cmath_asin(PyObject *module, PyObject *arg) Py_complex z; Py_complex _return_value; - if (!PyArg_Parse(arg, "D:asin", &z)) + if (!PyArg_Parse(arg, "D:asin", &z)) { goto exit; + } /* modifications for z */ errno = 0; PyFPE_START_PROTECT("complex function", goto exit); _return_value = cmath_asin_impl(module, z); @@ -144,8 +147,9 @@ cmath_asinh(PyObject *module, PyObject *arg) Py_complex z; Py_complex _return_value; - if (!PyArg_Parse(arg, "D:asinh", &z)) + if (!PyArg_Parse(arg, "D:asinh", &z)) { goto exit; + } /* modifications for z */ errno = 0; PyFPE_START_PROTECT("complex function", goto exit); _return_value = cmath_asinh_impl(module, z); @@ -185,8 +189,9 @@ cmath_atan(PyObject *module, PyObject *arg) Py_complex z; Py_complex _return_value; - if (!PyArg_Parse(arg, "D:atan", &z)) + if (!PyArg_Parse(arg, "D:atan", &z)) { goto exit; + } /* modifications for z */ errno = 0; PyFPE_START_PROTECT("complex function", goto exit); _return_value = cmath_atan_impl(module, z); @@ -226,8 +231,9 @@ cmath_atanh(PyObject *module, PyObject *arg) Py_complex z; Py_complex _return_value; - if (!PyArg_Parse(arg, "D:atanh", &z)) + if (!PyArg_Parse(arg, "D:atanh", &z)) { goto exit; + } /* modifications for z */ errno = 0; PyFPE_START_PROTECT("complex function", goto exit); _return_value = cmath_atanh_impl(module, z); @@ -267,8 +273,9 @@ cmath_cos(PyObject *module, PyObject *arg) Py_complex z; Py_complex _return_value; - if (!PyArg_Parse(arg, "D:cos", &z)) + if (!PyArg_Parse(arg, "D:cos", &z)) { goto exit; + } /* modifications for z */ errno = 0; PyFPE_START_PROTECT("complex function", goto exit); _return_value = cmath_cos_impl(module, z); @@ -308,8 +315,9 @@ cmath_cosh(PyObject *module, PyObject *arg) Py_complex z; Py_complex _return_value; - if (!PyArg_Parse(arg, "D:cosh", &z)) + if (!PyArg_Parse(arg, "D:cosh", &z)) { goto exit; + } /* modifications for z */ errno = 0; PyFPE_START_PROTECT("complex function", goto exit); _return_value = cmath_cosh_impl(module, z); @@ -349,8 +357,9 @@ cmath_exp(PyObject *module, PyObject *arg) Py_complex z; Py_complex _return_value; - if (!PyArg_Parse(arg, "D:exp", &z)) + if (!PyArg_Parse(arg, "D:exp", &z)) { goto exit; + } /* modifications for z */ errno = 0; PyFPE_START_PROTECT("complex function", goto exit); _return_value = cmath_exp_impl(module, z); @@ -390,8 +399,9 @@ cmath_log10(PyObject *module, PyObject *arg) Py_complex z; Py_complex _return_value; - if (!PyArg_Parse(arg, "D:log10", &z)) + if (!PyArg_Parse(arg, "D:log10", &z)) { goto exit; + } /* modifications for z */ errno = 0; PyFPE_START_PROTECT("complex function", goto exit); _return_value = cmath_log10_impl(module, z); @@ -431,8 +441,9 @@ cmath_sin(PyObject *module, PyObject *arg) Py_complex z; Py_complex _return_value; - if (!PyArg_Parse(arg, "D:sin", &z)) + if (!PyArg_Parse(arg, "D:sin", &z)) { goto exit; + } /* modifications for z */ errno = 0; PyFPE_START_PROTECT("complex function", goto exit); _return_value = cmath_sin_impl(module, z); @@ -472,8 +483,9 @@ cmath_sinh(PyObject *module, PyObject *arg) Py_complex z; Py_complex _return_value; - if (!PyArg_Parse(arg, "D:sinh", &z)) + if (!PyArg_Parse(arg, "D:sinh", &z)) { goto exit; + } /* modifications for z */ errno = 0; PyFPE_START_PROTECT("complex function", goto exit); _return_value = cmath_sinh_impl(module, z); @@ -513,8 +525,9 @@ cmath_sqrt(PyObject *module, PyObject *arg) Py_complex z; Py_complex _return_value; - if (!PyArg_Parse(arg, "D:sqrt", &z)) + if (!PyArg_Parse(arg, "D:sqrt", &z)) { goto exit; + } /* modifications for z */ errno = 0; PyFPE_START_PROTECT("complex function", goto exit); _return_value = cmath_sqrt_impl(module, z); @@ -554,8 +567,9 @@ cmath_tan(PyObject *module, PyObject *arg) Py_complex z; Py_complex _return_value; - if (!PyArg_Parse(arg, "D:tan", &z)) + if (!PyArg_Parse(arg, "D:tan", &z)) { goto exit; + } /* modifications for z */ errno = 0; PyFPE_START_PROTECT("complex function", goto exit); _return_value = cmath_tan_impl(module, z); @@ -595,8 +609,9 @@ cmath_tanh(PyObject *module, PyObject *arg) Py_complex z; Py_complex _return_value; - if (!PyArg_Parse(arg, "D:tanh", &z)) + if (!PyArg_Parse(arg, "D:tanh", &z)) { goto exit; + } /* modifications for z */ errno = 0; PyFPE_START_PROTECT("complex function", goto exit); _return_value = cmath_tanh_impl(module, z); @@ -639,8 +654,9 @@ cmath_log(PyObject *module, PyObject *args) PyObject *y_obj = NULL; if (!PyArg_ParseTuple(args, "D|O:log", - &x, &y_obj)) + &x, &y_obj)) { goto exit; + } return_value = cmath_log_impl(module, x, y_obj); exit: @@ -665,8 +681,9 @@ cmath_phase(PyObject *module, PyObject *arg) PyObject *return_value = NULL; Py_complex z; - if (!PyArg_Parse(arg, "D:phase", &z)) + if (!PyArg_Parse(arg, "D:phase", &z)) { goto exit; + } return_value = cmath_phase_impl(module, z); exit: @@ -693,8 +710,9 @@ cmath_polar(PyObject *module, PyObject *arg) PyObject *return_value = NULL; Py_complex z; - if (!PyArg_Parse(arg, "D:polar", &z)) + if (!PyArg_Parse(arg, "D:polar", &z)) { goto exit; + } return_value = cmath_polar_impl(module, z); exit: @@ -721,8 +739,9 @@ cmath_rect(PyObject *module, PyObject *args) double phi; if (!PyArg_ParseTuple(args, "dd:rect", - &r, &phi)) + &r, &phi)) { goto exit; + } return_value = cmath_rect_impl(module, r, phi); exit: @@ -747,8 +766,9 @@ cmath_isfinite(PyObject *module, PyObject *arg) PyObject *return_value = NULL; Py_complex z; - if (!PyArg_Parse(arg, "D:isfinite", &z)) + if (!PyArg_Parse(arg, "D:isfinite", &z)) { goto exit; + } return_value = cmath_isfinite_impl(module, z); exit: @@ -773,8 +793,9 @@ cmath_isnan(PyObject *module, PyObject *arg) PyObject *return_value = NULL; Py_complex z; - if (!PyArg_Parse(arg, "D:isnan", &z)) + if (!PyArg_Parse(arg, "D:isnan", &z)) { goto exit; + } return_value = cmath_isnan_impl(module, z); exit: @@ -799,8 +820,9 @@ cmath_isinf(PyObject *module, PyObject *arg) PyObject *return_value = NULL; Py_complex z; - if (!PyArg_Parse(arg, "D:isinf", &z)) + if (!PyArg_Parse(arg, "D:isinf", &z)) { goto exit; + } return_value = cmath_isinf_impl(module, z); exit: @@ -839,22 +861,25 @@ static PyObject * cmath_isclose(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"a", "b", "rel_tol", "abs_tol", NULL}; + static const char * const _keywords[] = {"a", "b", "rel_tol", "abs_tol", NULL}; + static _PyArg_Parser _parser = {"DD|$dd:isclose", _keywords, 0}; Py_complex a; Py_complex b; double rel_tol = 1e-09; double abs_tol = 0.0; int _return_value; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "DD|$dd:isclose", _keywords, - &a, &b, &rel_tol, &abs_tol)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &a, &b, &rel_tol, &abs_tol)) { goto exit; + } _return_value = cmath_isclose_impl(module, a, b, rel_tol, abs_tol); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyBool_FromLong((long)_return_value); exit: return return_value; } -/*[clinic end generated code: output=732194029b7fb1e7 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=aa2e77ca9fc26928 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/fcntlmodule.c.h b/Modules/clinic/fcntlmodule.c.h index 67660eb..84a004b 100644 --- a/Modules/clinic/fcntlmodule.c.h +++ b/Modules/clinic/fcntlmodule.c.h @@ -33,8 +33,9 @@ fcntl_fcntl(PyObject *module, PyObject *args) PyObject *arg = NULL; if (!PyArg_ParseTuple(args, "O&i|O:fcntl", - conv_descriptor, &fd, &code, &arg)) + conv_descriptor, &fd, &code, &arg)) { goto exit; + } return_value = fcntl_fcntl_impl(module, fd, code, arg); exit: @@ -91,8 +92,9 @@ fcntl_ioctl(PyObject *module, PyObject *args) int mutate_arg = 1; if (!PyArg_ParseTuple(args, "O&I|Op:ioctl", - conv_descriptor, &fd, &code, &ob_arg, &mutate_arg)) + conv_descriptor, &fd, &code, &ob_arg, &mutate_arg)) { goto exit; + } return_value = fcntl_ioctl_impl(module, fd, code, ob_arg, mutate_arg); exit: @@ -122,8 +124,9 @@ fcntl_flock(PyObject *module, PyObject *args) int code; if (!PyArg_ParseTuple(args, "O&i:flock", - conv_descriptor, &fd, &code)) + conv_descriptor, &fd, &code)) { goto exit; + } return_value = fcntl_flock_impl(module, fd, code); exit: @@ -175,11 +178,12 @@ fcntl_lockf(PyObject *module, PyObject *args) int whence = 0; if (!PyArg_ParseTuple(args, "O&i|OOi:lockf", - conv_descriptor, &fd, &code, &lenobj, &startobj, &whence)) + conv_descriptor, &fd, &code, &lenobj, &startobj, &whence)) { goto exit; + } return_value = fcntl_lockf_impl(module, fd, code, lenobj, startobj, whence); exit: return return_value; } -/*[clinic end generated code: output=97b1306b864c01c8 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=36cff76a8fb2c9a6 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/grpmodule.c.h b/Modules/clinic/grpmodule.c.h index 2c47a42..9c9d595 100644 --- a/Modules/clinic/grpmodule.c.h +++ b/Modules/clinic/grpmodule.c.h @@ -20,12 +20,14 @@ static PyObject * grp_getgrgid(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"id", NULL}; + static const char * const _keywords[] = {"id", NULL}; + static _PyArg_Parser _parser = {"O:getgrgid", _keywords, 0}; PyObject *id; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:getgrgid", _keywords, - &id)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &id)) { goto exit; + } return_value = grp_getgrgid_impl(module, id); exit: @@ -50,12 +52,14 @@ static PyObject * grp_getgrnam(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"name", NULL}; + static const char * const _keywords[] = {"name", NULL}; + static _PyArg_Parser _parser = {"U:getgrnam", _keywords, 0}; PyObject *name; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "U:getgrnam", _keywords, - &name)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &name)) { goto exit; + } return_value = grp_getgrnam_impl(module, name); exit: @@ -82,4 +86,4 @@ grp_getgrall(PyObject *module, PyObject *Py_UNUSED(ignored)) { return grp_getgrall_impl(module); } -/*[clinic end generated code: output=bee09feefc54a2cb input=a9049054013a1b77]*/ +/*[clinic end generated code: output=c06081097b7fffe7 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/md5module.c.h b/Modules/clinic/md5module.c.h index 0bd958a..aeb1c41 100644 --- a/Modules/clinic/md5module.c.h +++ b/Modules/clinic/md5module.c.h @@ -81,15 +81,17 @@ static PyObject * _md5_md5(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"string", NULL}; + static const char * const _keywords[] = {"string", NULL}; + static _PyArg_Parser _parser = {"|O:md5", _keywords, 0}; PyObject *string = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:md5", _keywords, - &string)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &string)) { goto exit; + } return_value = _md5_md5_impl(module, string); exit: return return_value; } -/*[clinic end generated code: output=4cd3cc96e35563d2 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=f86fc2f3f21831e2 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h index be2e5a6..26dedd1 100644 --- a/Modules/clinic/posixmodule.c.h +++ b/Modules/clinic/posixmodule.c.h @@ -36,14 +36,16 @@ static PyObject * os_stat(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", "dir_fd", "follow_symlinks", NULL}; + static const char * const _keywords[] = {"path", "dir_fd", "follow_symlinks", NULL}; + static _PyArg_Parser _parser = {"O&|$O&p:stat", _keywords, 0}; path_t path = PATH_T_INITIALIZE("stat", "path", 0, 1); int dir_fd = DEFAULT_DIR_FD; int follow_symlinks = 1; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|$O&p:stat", _keywords, - path_converter, &path, FSTATAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &path, FSTATAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) { goto exit; + } return_value = os_stat_impl(module, &path, dir_fd, follow_symlinks); exit: @@ -72,13 +74,15 @@ static PyObject * os_lstat(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", "dir_fd", NULL}; + static const char * const _keywords[] = {"path", "dir_fd", NULL}; + static _PyArg_Parser _parser = {"O&|$O&:lstat", _keywords, 0}; path_t path = PATH_T_INITIALIZE("lstat", "path", 0, 0); int dir_fd = DEFAULT_DIR_FD; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|$O&:lstat", _keywords, - path_converter, &path, FSTATAT_DIR_FD_CONVERTER, &dir_fd)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &path, FSTATAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; + } return_value = os_lstat_impl(module, &path, dir_fd); exit: @@ -131,7 +135,8 @@ static PyObject * os_access(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", "mode", "dir_fd", "effective_ids", "follow_symlinks", NULL}; + static const char * const _keywords[] = {"path", "mode", "dir_fd", "effective_ids", "follow_symlinks", NULL}; + static _PyArg_Parser _parser = {"O&i|$O&pp:access", _keywords, 0}; path_t path = PATH_T_INITIALIZE("access", "path", 0, 1); int mode; int dir_fd = DEFAULT_DIR_FD; @@ -139,12 +144,14 @@ os_access(PyObject *module, PyObject *args, PyObject *kwargs) int follow_symlinks = 1; int _return_value; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&i|$O&pp:access", _keywords, - path_converter, &path, &mode, FACCESSAT_DIR_FD_CONVERTER, &dir_fd, &effective_ids, &follow_symlinks)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &path, &mode, FACCESSAT_DIR_FD_CONVERTER, &dir_fd, &effective_ids, &follow_symlinks)) { goto exit; + } _return_value = os_access_impl(module, &path, mode, dir_fd, effective_ids, follow_symlinks); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyBool_FromLong((long)_return_value); exit: @@ -178,11 +185,13 @@ os_ttyname(PyObject *module, PyObject *arg) int fd; char *_return_value; - if (!PyArg_Parse(arg, "i:ttyname", &fd)) + if (!PyArg_Parse(arg, "i:ttyname", &fd)) { goto exit; + } _return_value = os_ttyname_impl(module, fd); - if (_return_value == NULL) + if (_return_value == NULL) { goto exit; + } return_value = PyUnicode_DecodeFSDefault(_return_value); exit: @@ -233,12 +242,14 @@ static PyObject * os_chdir(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", NULL}; + static const char * const _keywords[] = {"path", NULL}; + static _PyArg_Parser _parser = {"O&:chdir", _keywords, 0}; path_t path = PATH_T_INITIALIZE("chdir", "path", 0, PATH_HAVE_FCHDIR); - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:chdir", _keywords, - path_converter, &path)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &path)) { goto exit; + } return_value = os_chdir_impl(module, &path); exit: @@ -269,12 +280,14 @@ static PyObject * os_fchdir(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"fd", NULL}; + static const char * const _keywords[] = {"fd", NULL}; + static _PyArg_Parser _parser = {"O&:fchdir", _keywords, 0}; int fd; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:fchdir", _keywords, - fildes_converter, &fd)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + fildes_converter, &fd)) { goto exit; + } return_value = os_fchdir_impl(module, fd); exit: @@ -320,15 +333,17 @@ static PyObject * os_chmod(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", "mode", "dir_fd", "follow_symlinks", NULL}; + static const char * const _keywords[] = {"path", "mode", "dir_fd", "follow_symlinks", NULL}; + static _PyArg_Parser _parser = {"O&i|$O&p:chmod", _keywords, 0}; path_t path = PATH_T_INITIALIZE("chmod", "path", 0, PATH_HAVE_FCHMOD); int mode; int dir_fd = DEFAULT_DIR_FD; int follow_symlinks = 1; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&i|$O&p:chmod", _keywords, - path_converter, &path, &mode, FCHMODAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &path, &mode, FCHMODAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) { goto exit; + } return_value = os_chmod_impl(module, &path, mode, dir_fd, follow_symlinks); exit: @@ -358,13 +373,15 @@ static PyObject * os_fchmod(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"fd", "mode", NULL}; + static const char * const _keywords[] = {"fd", "mode", NULL}; + static _PyArg_Parser _parser = {"ii:fchmod", _keywords, 0}; int fd; int mode; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii:fchmod", _keywords, - &fd, &mode)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &fd, &mode)) { goto exit; + } return_value = os_fchmod_impl(module, fd, mode); exit: @@ -394,13 +411,15 @@ static PyObject * os_lchmod(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", "mode", NULL}; + static const char * const _keywords[] = {"path", "mode", NULL}; + static _PyArg_Parser _parser = {"O&i:lchmod", _keywords, 0}; path_t path = PATH_T_INITIALIZE("lchmod", "path", 0, 0); int mode; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&i:lchmod", _keywords, - path_converter, &path, &mode)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &path, &mode)) { goto exit; + } return_value = os_lchmod_impl(module, &path, mode); exit: @@ -437,14 +456,16 @@ static PyObject * os_chflags(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", "flags", "follow_symlinks", NULL}; + static const char * const _keywords[] = {"path", "flags", "follow_symlinks", NULL}; + static _PyArg_Parser _parser = {"O&k|p:chflags", _keywords, 0}; path_t path = PATH_T_INITIALIZE("chflags", "path", 0, 0); unsigned long flags; int follow_symlinks = 1; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&k|p:chflags", _keywords, - path_converter, &path, &flags, &follow_symlinks)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &path, &flags, &follow_symlinks)) { goto exit; + } return_value = os_chflags_impl(module, &path, flags, follow_symlinks); exit: @@ -477,13 +498,15 @@ static PyObject * os_lchflags(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", "flags", NULL}; + static const char * const _keywords[] = {"path", "flags", NULL}; + static _PyArg_Parser _parser = {"O&k:lchflags", _keywords, 0}; path_t path = PATH_T_INITIALIZE("lchflags", "path", 0, 0); unsigned long flags; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&k:lchflags", _keywords, - path_converter, &path, &flags)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &path, &flags)) { goto exit; + } return_value = os_lchflags_impl(module, &path, flags); exit: @@ -513,12 +536,14 @@ static PyObject * os_chroot(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", NULL}; + static const char * const _keywords[] = {"path", NULL}; + static _PyArg_Parser _parser = {"O&:chroot", _keywords, 0}; path_t path = PATH_T_INITIALIZE("chroot", "path", 0, 0); - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:chroot", _keywords, - path_converter, &path)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &path)) { goto exit; + } return_value = os_chroot_impl(module, &path); exit: @@ -548,12 +573,14 @@ static PyObject * os_fsync(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"fd", NULL}; + static const char * const _keywords[] = {"fd", NULL}; + static _PyArg_Parser _parser = {"O&:fsync", _keywords, 0}; int fd; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:fsync", _keywords, - fildes_converter, &fd)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + fildes_converter, &fd)) { goto exit; + } return_value = os_fsync_impl(module, fd); exit: @@ -602,12 +629,14 @@ static PyObject * os_fdatasync(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"fd", NULL}; + static const char * const _keywords[] = {"fd", NULL}; + static _PyArg_Parser _parser = {"O&:fdatasync", _keywords, 0}; int fd; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:fdatasync", _keywords, - fildes_converter, &fd)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + fildes_converter, &fd)) { goto exit; + } return_value = os_fdatasync_impl(module, fd); exit: @@ -659,16 +688,18 @@ static PyObject * os_chown(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", "uid", "gid", "dir_fd", "follow_symlinks", NULL}; + static const char * const _keywords[] = {"path", "uid", "gid", "dir_fd", "follow_symlinks", NULL}; + static _PyArg_Parser _parser = {"O&O&O&|$O&p:chown", _keywords, 0}; path_t path = PATH_T_INITIALIZE("chown", "path", 0, PATH_HAVE_FCHOWN); uid_t uid; gid_t gid; int dir_fd = DEFAULT_DIR_FD; int follow_symlinks = 1; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&O&|$O&p:chown", _keywords, - path_converter, &path, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid, FCHOWNAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &path, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid, FCHOWNAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) { goto exit; + } return_value = os_chown_impl(module, &path, uid, gid, dir_fd, follow_symlinks); exit: @@ -700,14 +731,16 @@ static PyObject * os_fchown(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"fd", "uid", "gid", NULL}; + static const char * const _keywords[] = {"fd", "uid", "gid", NULL}; + static _PyArg_Parser _parser = {"iO&O&:fchown", _keywords, 0}; int fd; uid_t uid; gid_t gid; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "iO&O&:fchown", _keywords, - &fd, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &fd, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid)) { goto exit; + } return_value = os_fchown_impl(module, fd, uid, gid); exit: @@ -737,14 +770,16 @@ static PyObject * os_lchown(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", "uid", "gid", NULL}; + static const char * const _keywords[] = {"path", "uid", "gid", NULL}; + static _PyArg_Parser _parser = {"O&O&O&:lchown", _keywords, 0}; path_t path = PATH_T_INITIALIZE("lchown", "path", 0, 0); uid_t uid; gid_t gid; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&O&:lchown", _keywords, - path_converter, &path, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &path, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid)) { goto exit; + } return_value = os_lchown_impl(module, &path, uid, gid); exit: @@ -822,16 +857,18 @@ static PyObject * os_link(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"src", "dst", "src_dir_fd", "dst_dir_fd", "follow_symlinks", NULL}; + static const char * const _keywords[] = {"src", "dst", "src_dir_fd", "dst_dir_fd", "follow_symlinks", NULL}; + static _PyArg_Parser _parser = {"O&O&|$O&O&p:link", _keywords, 0}; path_t src = PATH_T_INITIALIZE("link", "src", 0, 0); path_t dst = PATH_T_INITIALIZE("link", "dst", 0, 0); int src_dir_fd = DEFAULT_DIR_FD; int dst_dir_fd = DEFAULT_DIR_FD; int follow_symlinks = 1; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&|$O&O&p:link", _keywords, - path_converter, &src, path_converter, &dst, dir_fd_converter, &src_dir_fd, dir_fd_converter, &dst_dir_fd, &follow_symlinks)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &src, path_converter, &dst, dir_fd_converter, &src_dir_fd, dir_fd_converter, &dst_dir_fd, &follow_symlinks)) { goto exit; + } return_value = os_link_impl(module, &src, &dst, src_dir_fd, dst_dir_fd, follow_symlinks); exit: @@ -872,12 +909,14 @@ static PyObject * os_listdir(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", NULL}; + static const char * const _keywords[] = {"path", NULL}; + static _PyArg_Parser _parser = {"|O&:listdir", _keywords, 0}; path_t path = PATH_T_INITIALIZE("listdir", "path", 1, PATH_HAVE_FDOPENDIR); - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O&:listdir", _keywords, - path_converter, &path)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &path)) { goto exit; + } return_value = os_listdir_impl(module, &path); exit: @@ -906,8 +945,9 @@ os__getfullpathname(PyObject *module, PyObject *arg) PyObject *return_value = NULL; path_t path = PATH_T_INITIALIZE("_getfullpathname", "path", 0, 0); - if (!PyArg_Parse(arg, "O&:_getfullpathname", path_converter, &path)) + if (!PyArg_Parse(arg, "O&:_getfullpathname", path_converter, &path)) { goto exit; + } return_value = os__getfullpathname_impl(module, &path); exit: @@ -939,8 +979,9 @@ os__getfinalpathname(PyObject *module, PyObject *arg) PyObject *return_value = NULL; PyObject *path; - if (!PyArg_Parse(arg, "U:_getfinalpathname", &path)) + if (!PyArg_Parse(arg, "U:_getfinalpathname", &path)) { goto exit; + } return_value = os__getfinalpathname_impl(module, path); exit: @@ -968,8 +1009,9 @@ os__isdir(PyObject *module, PyObject *arg) PyObject *return_value = NULL; path_t path = PATH_T_INITIALIZE("_isdir", "path", 0, 0); - if (!PyArg_Parse(arg, "O&:_isdir", path_converter, &path)) + if (!PyArg_Parse(arg, "O&:_isdir", path_converter, &path)) { goto exit; + } return_value = os__isdir_impl(module, &path); exit: @@ -999,12 +1041,14 @@ static PyObject * os__getvolumepathname(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", NULL}; + static const char * const _keywords[] = {"path", NULL}; + static _PyArg_Parser _parser = {"U:_getvolumepathname", _keywords, 0}; PyObject *path; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "U:_getvolumepathname", _keywords, - &path)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &path)) { goto exit; + } return_value = os__getvolumepathname_impl(module, path); exit: @@ -1036,14 +1080,16 @@ static PyObject * os_mkdir(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", "mode", "dir_fd", NULL}; + static const char * const _keywords[] = {"path", "mode", "dir_fd", NULL}; + static _PyArg_Parser _parser = {"O&|i$O&:mkdir", _keywords, 0}; path_t path = PATH_T_INITIALIZE("mkdir", "path", 0, 0); int mode = 511; int dir_fd = DEFAULT_DIR_FD; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|i$O&:mkdir", _keywords, - path_converter, &path, &mode, MKDIRAT_DIR_FD_CONVERTER, &dir_fd)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &path, &mode, MKDIRAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; + } return_value = os_mkdir_impl(module, &path, mode, dir_fd); exit: @@ -1073,8 +1119,9 @@ os_nice(PyObject *module, PyObject *arg) PyObject *return_value = NULL; int increment; - if (!PyArg_Parse(arg, "i:nice", &increment)) + if (!PyArg_Parse(arg, "i:nice", &increment)) { goto exit; + } return_value = os_nice_impl(module, increment); exit: @@ -1101,13 +1148,15 @@ static PyObject * os_getpriority(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"which", "who", NULL}; + static const char * const _keywords[] = {"which", "who", NULL}; + static _PyArg_Parser _parser = {"ii:getpriority", _keywords, 0}; int which; int who; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii:getpriority", _keywords, - &which, &who)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &which, &who)) { goto exit; + } return_value = os_getpriority_impl(module, which, who); exit: @@ -1134,14 +1183,16 @@ static PyObject * os_setpriority(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"which", "who", "priority", NULL}; + static const char * const _keywords[] = {"which", "who", "priority", NULL}; + static _PyArg_Parser _parser = {"iii:setpriority", _keywords, 0}; int which; int who; int priority; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "iii:setpriority", _keywords, - &which, &who, &priority)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &which, &who, &priority)) { goto exit; + } return_value = os_setpriority_impl(module, which, who, priority); exit: @@ -1173,15 +1224,17 @@ static PyObject * os_rename(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"src", "dst", "src_dir_fd", "dst_dir_fd", NULL}; + static const char * const _keywords[] = {"src", "dst", "src_dir_fd", "dst_dir_fd", NULL}; + static _PyArg_Parser _parser = {"O&O&|$O&O&:rename", _keywords, 0}; path_t src = PATH_T_INITIALIZE("rename", "src", 0, 0); path_t dst = PATH_T_INITIALIZE("rename", "dst", 0, 0); int src_dir_fd = DEFAULT_DIR_FD; int dst_dir_fd = DEFAULT_DIR_FD; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&|$O&O&:rename", _keywords, - path_converter, &src, path_converter, &dst, dir_fd_converter, &src_dir_fd, dir_fd_converter, &dst_dir_fd)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &src, path_converter, &dst, dir_fd_converter, &src_dir_fd, dir_fd_converter, &dst_dir_fd)) { goto exit; + } return_value = os_rename_impl(module, &src, &dst, src_dir_fd, dst_dir_fd); exit: @@ -1216,15 +1269,17 @@ static PyObject * os_replace(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"src", "dst", "src_dir_fd", "dst_dir_fd", NULL}; + static const char * const _keywords[] = {"src", "dst", "src_dir_fd", "dst_dir_fd", NULL}; + static _PyArg_Parser _parser = {"O&O&|$O&O&:replace", _keywords, 0}; path_t src = PATH_T_INITIALIZE("replace", "src", 0, 0); path_t dst = PATH_T_INITIALIZE("replace", "dst", 0, 0); int src_dir_fd = DEFAULT_DIR_FD; int dst_dir_fd = DEFAULT_DIR_FD; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&|$O&O&:replace", _keywords, - path_converter, &src, path_converter, &dst, dir_fd_converter, &src_dir_fd, dir_fd_converter, &dst_dir_fd)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &src, path_converter, &dst, dir_fd_converter, &src_dir_fd, dir_fd_converter, &dst_dir_fd)) { goto exit; + } return_value = os_replace_impl(module, &src, &dst, src_dir_fd, dst_dir_fd); exit: @@ -1257,13 +1312,15 @@ static PyObject * os_rmdir(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", "dir_fd", NULL}; + static const char * const _keywords[] = {"path", "dir_fd", NULL}; + static _PyArg_Parser _parser = {"O&|$O&:rmdir", _keywords, 0}; path_t path = PATH_T_INITIALIZE("rmdir", "path", 0, 0); int dir_fd = DEFAULT_DIR_FD; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|$O&:rmdir", _keywords, - path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; + } return_value = os_rmdir_impl(module, &path, dir_fd); exit: @@ -1291,16 +1348,19 @@ static PyObject * os_system(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"command", NULL}; + static const char * const _keywords[] = {"command", NULL}; + static _PyArg_Parser _parser = {"u:system", _keywords, 0}; Py_UNICODE *command; long _return_value; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "u:system", _keywords, - &command)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &command)) { goto exit; + } _return_value = os_system_impl(module, command); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong(_return_value); exit: @@ -1327,16 +1387,19 @@ static PyObject * os_system(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"command", NULL}; + static const char * const _keywords[] = {"command", NULL}; + static _PyArg_Parser _parser = {"O&:system", _keywords, 0}; PyObject *command = NULL; long _return_value; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:system", _keywords, - PyUnicode_FSConverter, &command)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + PyUnicode_FSConverter, &command)) { goto exit; + } _return_value = os_system_impl(module, command); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong(_return_value); exit: @@ -1366,8 +1429,9 @@ os_umask(PyObject *module, PyObject *arg) PyObject *return_value = NULL; int mask; - if (!PyArg_Parse(arg, "i:umask", &mask)) + if (!PyArg_Parse(arg, "i:umask", &mask)) { goto exit; + } return_value = os_umask_impl(module, mask); exit: @@ -1395,13 +1459,15 @@ static PyObject * os_unlink(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", "dir_fd", NULL}; + static const char * const _keywords[] = {"path", "dir_fd", NULL}; + static _PyArg_Parser _parser = {"O&|$O&:unlink", _keywords, 0}; path_t path = PATH_T_INITIALIZE("unlink", "path", 0, 0); int dir_fd = DEFAULT_DIR_FD; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|$O&:unlink", _keywords, - path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; + } return_value = os_unlink_impl(module, &path, dir_fd); exit: @@ -1432,13 +1498,15 @@ static PyObject * os_remove(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", "dir_fd", NULL}; + static const char * const _keywords[] = {"path", "dir_fd", NULL}; + static _PyArg_Parser _parser = {"O&|$O&:remove", _keywords, 0}; path_t path = PATH_T_INITIALIZE("remove", "path", 0, 0); int dir_fd = DEFAULT_DIR_FD; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|$O&:remove", _keywords, - path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; + } return_value = os_remove_impl(module, &path, dir_fd); exit: @@ -1513,16 +1581,18 @@ static PyObject * os_utime(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", "times", "ns", "dir_fd", "follow_symlinks", NULL}; + static const char * const _keywords[] = {"path", "times", "ns", "dir_fd", "follow_symlinks", NULL}; + static _PyArg_Parser _parser = {"O&|O$OO&p:utime", _keywords, 0}; path_t path = PATH_T_INITIALIZE("utime", "path", 0, PATH_UTIME_HAVE_FD); PyObject *times = NULL; PyObject *ns = NULL; int dir_fd = DEFAULT_DIR_FD; int follow_symlinks = 1; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|O$OO&p:utime", _keywords, - path_converter, &path, ×, &ns, FUTIMENSAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &path, ×, &ns, FUTIMENSAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) { goto exit; + } return_value = os_utime_impl(module, &path, times, ns, dir_fd, follow_symlinks); exit: @@ -1548,12 +1618,14 @@ static PyObject * os__exit(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"status", NULL}; + static const char * const _keywords[] = {"status", NULL}; + static _PyArg_Parser _parser = {"i:_exit", _keywords, 0}; int status; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:_exit", _keywords, - &status)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &status)) { goto exit; + } return_value = os__exit_impl(module, status); exit: @@ -1587,8 +1659,9 @@ os_execv(PyObject *module, PyObject *args) PyObject *argv; if (!PyArg_ParseTuple(args, "O&O:execv", - PyUnicode_FSConverter, &path, &argv)) + PyUnicode_FSConverter, &path, &argv)) { goto exit; + } return_value = os_execv_impl(module, path, argv); exit: @@ -1625,14 +1698,16 @@ static PyObject * os_execve(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", "argv", "env", NULL}; + static const char * const _keywords[] = {"path", "argv", "env", NULL}; + static _PyArg_Parser _parser = {"O&OO:execve", _keywords, 0}; path_t path = PATH_T_INITIALIZE("execve", "path", 0, PATH_HAVE_FEXECVE); PyObject *argv; PyObject *env; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&OO:execve", _keywords, - path_converter, &path, &argv, &env)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &path, &argv, &env)) { goto exit; + } return_value = os_execve_impl(module, &path, argv, env); exit: @@ -1674,8 +1749,9 @@ os_spawnv(PyObject *module, PyObject *args) PyObject *argv; if (!PyArg_ParseTuple(args, "iO&O:spawnv", - &mode, PyUnicode_FSConverter, &path, &argv)) + &mode, PyUnicode_FSConverter, &path, &argv)) { goto exit; + } return_value = os_spawnv_impl(module, mode, path, argv); exit: @@ -1721,8 +1797,9 @@ os_spawnve(PyObject *module, PyObject *args) PyObject *env; if (!PyArg_ParseTuple(args, "iO&OO:spawnve", - &mode, PyUnicode_FSConverter, &path, &argv, &env)) + &mode, PyUnicode_FSConverter, &path, &argv, &env)) { goto exit; + } return_value = os_spawnve_impl(module, mode, path, argv, env); exit: @@ -1800,12 +1877,14 @@ static PyObject * os_sched_get_priority_max(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"policy", NULL}; + static const char * const _keywords[] = {"policy", NULL}; + static _PyArg_Parser _parser = {"i:sched_get_priority_max", _keywords, 0}; int policy; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:sched_get_priority_max", _keywords, - &policy)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &policy)) { goto exit; + } return_value = os_sched_get_priority_max_impl(module, policy); exit: @@ -1832,12 +1911,14 @@ static PyObject * os_sched_get_priority_min(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"policy", NULL}; + static const char * const _keywords[] = {"policy", NULL}; + static _PyArg_Parser _parser = {"i:sched_get_priority_min", _keywords, 0}; int policy; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:sched_get_priority_min", _keywords, - &policy)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &policy)) { goto exit; + } return_value = os_sched_get_priority_min_impl(module, policy); exit: @@ -1868,8 +1949,9 @@ os_sched_getscheduler(PyObject *module, PyObject *arg) PyObject *return_value = NULL; pid_t pid; - if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_getscheduler", &pid)) + if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_getscheduler", &pid)) { goto exit; + } return_value = os_sched_getscheduler_impl(module, pid); exit: @@ -1896,12 +1978,14 @@ static PyObject * os_sched_param(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"sched_priority", NULL}; + static const char * const _keywords[] = {"sched_priority", NULL}; + static _PyArg_Parser _parser = {"O:sched_param", _keywords, 0}; PyObject *sched_priority; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:sched_param", _keywords, - &sched_priority)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &sched_priority)) { goto exit; + } return_value = os_sched_param_impl(type, sched_priority); exit: @@ -1937,8 +2021,9 @@ os_sched_setscheduler(PyObject *module, PyObject *args) struct sched_param param; if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "iO&:sched_setscheduler", - &pid, &policy, convert_sched_param, ¶m)) + &pid, &policy, convert_sched_param, ¶m)) { goto exit; + } return_value = os_sched_setscheduler_impl(module, pid, policy, ¶m); exit: @@ -1970,8 +2055,9 @@ os_sched_getparam(PyObject *module, PyObject *arg) PyObject *return_value = NULL; pid_t pid; - if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_getparam", &pid)) + if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_getparam", &pid)) { goto exit; + } return_value = os_sched_getparam_impl(module, pid); exit: @@ -2006,8 +2092,9 @@ os_sched_setparam(PyObject *module, PyObject *args) struct sched_param param; if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "O&:sched_setparam", - &pid, convert_sched_param, ¶m)) + &pid, convert_sched_param, ¶m)) { goto exit; + } return_value = os_sched_setparam_impl(module, pid, ¶m); exit: @@ -2039,11 +2126,13 @@ os_sched_rr_get_interval(PyObject *module, PyObject *arg) pid_t pid; double _return_value; - if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_rr_get_interval", &pid)) + if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_rr_get_interval", &pid)) { goto exit; + } _return_value = os_sched_rr_get_interval_impl(module, pid); - if ((_return_value == -1.0) && PyErr_Occurred()) + if ((_return_value == -1.0) && PyErr_Occurred()) { goto exit; + } return_value = PyFloat_FromDouble(_return_value); exit: @@ -2098,8 +2187,9 @@ os_sched_setaffinity(PyObject *module, PyObject *args) PyObject *mask; if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "O:sched_setaffinity", - &pid, &mask)) + &pid, &mask)) { goto exit; + } return_value = os_sched_setaffinity_impl(module, pid, mask); exit: @@ -2114,7 +2204,7 @@ PyDoc_STRVAR(os_sched_getaffinity__doc__, "sched_getaffinity($module, pid, /)\n" "--\n" "\n" -"Return the affinity of the process identified by pid.\n" +"Return the affinity of the process identified by pid (or the current process if zero).\n" "\n" "The affinity is returned as a set of CPU identifiers."); @@ -2130,8 +2220,9 @@ os_sched_getaffinity(PyObject *module, PyObject *arg) PyObject *return_value = NULL; pid_t pid; - if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_getaffinity", &pid)) + if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_getaffinity", &pid)) { goto exit; + } return_value = os_sched_getaffinity_impl(module, pid); exit: @@ -2316,12 +2407,14 @@ static PyObject * os_getpgid(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"pid", NULL}; + static const char * const _keywords[] = {"pid", NULL}; + static _PyArg_Parser _parser = {"" _Py_PARSE_PID ":getpgid", _keywords, 0}; pid_t pid; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "" _Py_PARSE_PID ":getpgid", _keywords, - &pid)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &pid)) { goto exit; + } return_value = os_getpgid_impl(module, pid); exit: @@ -2465,8 +2558,9 @@ os_kill(PyObject *module, PyObject *args) Py_ssize_t signal; if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "n:kill", - &pid, &signal)) + &pid, &signal)) { goto exit; + } return_value = os_kill_impl(module, pid, signal); exit: @@ -2497,8 +2591,9 @@ os_killpg(PyObject *module, PyObject *args) int signal; if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "i:killpg", - &pgid, &signal)) + &pgid, &signal)) { goto exit; + } return_value = os_killpg_impl(module, pgid, signal); exit: @@ -2527,8 +2622,9 @@ os_plock(PyObject *module, PyObject *arg) PyObject *return_value = NULL; int op; - if (!PyArg_Parse(arg, "i:plock", &op)) + if (!PyArg_Parse(arg, "i:plock", &op)) { goto exit; + } return_value = os_plock_impl(module, op); exit: @@ -2557,8 +2653,9 @@ os_setuid(PyObject *module, PyObject *arg) PyObject *return_value = NULL; uid_t uid; - if (!PyArg_Parse(arg, "O&:setuid", _Py_Uid_Converter, &uid)) + if (!PyArg_Parse(arg, "O&:setuid", _Py_Uid_Converter, &uid)) { goto exit; + } return_value = os_setuid_impl(module, uid); exit: @@ -2587,8 +2684,9 @@ os_seteuid(PyObject *module, PyObject *arg) PyObject *return_value = NULL; uid_t euid; - if (!PyArg_Parse(arg, "O&:seteuid", _Py_Uid_Converter, &euid)) + if (!PyArg_Parse(arg, "O&:seteuid", _Py_Uid_Converter, &euid)) { goto exit; + } return_value = os_seteuid_impl(module, euid); exit: @@ -2617,8 +2715,9 @@ os_setegid(PyObject *module, PyObject *arg) PyObject *return_value = NULL; gid_t egid; - if (!PyArg_Parse(arg, "O&:setegid", _Py_Gid_Converter, &egid)) + if (!PyArg_Parse(arg, "O&:setegid", _Py_Gid_Converter, &egid)) { goto exit; + } return_value = os_setegid_impl(module, egid); exit: @@ -2649,8 +2748,9 @@ os_setreuid(PyObject *module, PyObject *args) uid_t euid; if (!PyArg_ParseTuple(args, "O&O&:setreuid", - _Py_Uid_Converter, &ruid, _Py_Uid_Converter, &euid)) + _Py_Uid_Converter, &ruid, _Py_Uid_Converter, &euid)) { goto exit; + } return_value = os_setreuid_impl(module, ruid, euid); exit: @@ -2681,8 +2781,9 @@ os_setregid(PyObject *module, PyObject *args) gid_t egid; if (!PyArg_ParseTuple(args, "O&O&:setregid", - _Py_Gid_Converter, &rgid, _Py_Gid_Converter, &egid)) + _Py_Gid_Converter, &rgid, _Py_Gid_Converter, &egid)) { goto exit; + } return_value = os_setregid_impl(module, rgid, egid); exit: @@ -2711,8 +2812,9 @@ os_setgid(PyObject *module, PyObject *arg) PyObject *return_value = NULL; gid_t gid; - if (!PyArg_Parse(arg, "O&:setgid", _Py_Gid_Converter, &gid)) + if (!PyArg_Parse(arg, "O&:setgid", _Py_Gid_Converter, &gid)) { goto exit; + } return_value = os_setgid_impl(module, gid); exit: @@ -2755,12 +2857,14 @@ static PyObject * os_wait3(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"options", NULL}; + static const char * const _keywords[] = {"options", NULL}; + static _PyArg_Parser _parser = {"i:wait3", _keywords, 0}; int options; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:wait3", _keywords, - &options)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &options)) { goto exit; + } return_value = os_wait3_impl(module, options); exit: @@ -2790,13 +2894,15 @@ static PyObject * os_wait4(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"pid", "options", NULL}; + static const char * const _keywords[] = {"pid", "options", NULL}; + static _PyArg_Parser _parser = {"" _Py_PARSE_PID "i:wait4", _keywords, 0}; pid_t pid; int options; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "" _Py_PARSE_PID "i:wait4", _keywords, - &pid, &options)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &pid, &options)) { goto exit; + } return_value = os_wait4_impl(module, pid, options); exit: @@ -2839,8 +2945,9 @@ os_waitid(PyObject *module, PyObject *args) int options; if (!PyArg_ParseTuple(args, "i" _Py_PARSE_PID "i:waitid", - &idtype, &id, &options)) + &idtype, &id, &options)) { goto exit; + } return_value = os_waitid_impl(module, idtype, id, options); exit: @@ -2876,8 +2983,9 @@ os_waitpid(PyObject *module, PyObject *args) int options; if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "i:waitpid", - &pid, &options)) + &pid, &options)) { goto exit; + } return_value = os_waitpid_impl(module, pid, options); exit: @@ -2913,8 +3021,9 @@ os_waitpid(PyObject *module, PyObject *args) int options; if (!PyArg_ParseTuple(args, "" _Py_PARSE_INTPTR "i:waitpid", - &pid, &options)) + &pid, &options)) { goto exit; + } return_value = os_waitpid_impl(module, pid, options); exit: @@ -2977,15 +3086,17 @@ static PyObject * os_symlink(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"src", "dst", "target_is_directory", "dir_fd", NULL}; + static const char * const _keywords[] = {"src", "dst", "target_is_directory", "dir_fd", NULL}; + static _PyArg_Parser _parser = {"O&O&|p$O&:symlink", _keywords, 0}; path_t src = PATH_T_INITIALIZE("symlink", "src", 0, 0); path_t dst = PATH_T_INITIALIZE("symlink", "dst", 0, 0); int target_is_directory = 0; int dir_fd = DEFAULT_DIR_FD; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&|p$O&:symlink", _keywords, - path_converter, &src, path_converter, &dst, &target_is_directory, SYMLINKAT_DIR_FD_CONVERTER, &dir_fd)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &src, path_converter, &dst, &target_is_directory, SYMLINKAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; + } return_value = os_symlink_impl(module, &src, &dst, target_is_directory, dir_fd); exit: @@ -3045,8 +3156,9 @@ os_getsid(PyObject *module, PyObject *arg) PyObject *return_value = NULL; pid_t pid; - if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":getsid", &pid)) + if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":getsid", &pid)) { goto exit; + } return_value = os_getsid_impl(module, pid); exit: @@ -3099,8 +3211,9 @@ os_setpgid(PyObject *module, PyObject *args) pid_t pgrp; if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "" _Py_PARSE_PID ":setpgid", - &pid, &pgrp)) + &pid, &pgrp)) { goto exit; + } return_value = os_setpgid_impl(module, pid, pgrp); exit: @@ -3129,8 +3242,9 @@ os_tcgetpgrp(PyObject *module, PyObject *arg) PyObject *return_value = NULL; int fd; - if (!PyArg_Parse(arg, "i:tcgetpgrp", &fd)) + if (!PyArg_Parse(arg, "i:tcgetpgrp", &fd)) { goto exit; + } return_value = os_tcgetpgrp_impl(module, fd); exit: @@ -3161,8 +3275,9 @@ os_tcsetpgrp(PyObject *module, PyObject *args) pid_t pgid; if (!PyArg_ParseTuple(args, "i" _Py_PARSE_PID ":tcsetpgrp", - &fd, &pgid)) + &fd, &pgid)) { goto exit; + } return_value = os_tcsetpgrp_impl(module, fd, pgid); exit: @@ -3192,19 +3307,22 @@ static PyObject * os_open(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", "flags", "mode", "dir_fd", NULL}; + static const char * const _keywords[] = {"path", "flags", "mode", "dir_fd", NULL}; + static _PyArg_Parser _parser = {"O&i|i$O&:open", _keywords, 0}; path_t path = PATH_T_INITIALIZE("open", "path", 0, 0); int flags; int mode = 511; int dir_fd = DEFAULT_DIR_FD; int _return_value; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&i|i$O&:open", _keywords, - path_converter, &path, &flags, &mode, OPENAT_DIR_FD_CONVERTER, &dir_fd)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &path, &flags, &mode, OPENAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; + } _return_value = os_open_impl(module, &path, flags, mode, dir_fd); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong((long)_return_value); exit: @@ -3230,12 +3348,14 @@ static PyObject * os_close(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"fd", NULL}; + static const char * const _keywords[] = {"fd", NULL}; + static _PyArg_Parser _parser = {"i:close", _keywords, 0}; int fd; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:close", _keywords, - &fd)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &fd)) { goto exit; + } return_value = os_close_impl(module, fd); exit: @@ -3262,8 +3382,9 @@ os_closerange(PyObject *module, PyObject *args) int fd_high; if (!PyArg_ParseTuple(args, "ii:closerange", - &fd_low, &fd_high)) + &fd_low, &fd_high)) { goto exit; + } return_value = os_closerange_impl(module, fd_low, fd_high); exit: @@ -3289,11 +3410,13 @@ os_dup(PyObject *module, PyObject *arg) int fd; int _return_value; - if (!PyArg_Parse(arg, "i:dup", &fd)) + if (!PyArg_Parse(arg, "i:dup", &fd)) { goto exit; + } _return_value = os_dup_impl(module, fd); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong((long)_return_value); exit: @@ -3316,14 +3439,16 @@ static PyObject * os_dup2(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"fd", "fd2", "inheritable", NULL}; + static const char * const _keywords[] = {"fd", "fd2", "inheritable", NULL}; + static _PyArg_Parser _parser = {"ii|p:dup2", _keywords, 0}; int fd; int fd2; int inheritable = 1; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii|p:dup2", _keywords, - &fd, &fd2, &inheritable)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &fd, &fd2, &inheritable)) { goto exit; + } return_value = os_dup2_impl(module, fd, fd2, inheritable); exit: @@ -3360,8 +3485,9 @@ os_lockf(PyObject *module, PyObject *args) Py_off_t length; if (!PyArg_ParseTuple(args, "iiO&:lockf", - &fd, &command, Py_off_t_converter, &length)) + &fd, &command, Py_off_t_converter, &length)) { goto exit; + } return_value = os_lockf_impl(module, fd, command, length); exit: @@ -3395,11 +3521,13 @@ os_lseek(PyObject *module, PyObject *args) Py_off_t _return_value; if (!PyArg_ParseTuple(args, "iO&i:lseek", - &fd, Py_off_t_converter, &position, &how)) + &fd, Py_off_t_converter, &position, &how)) { goto exit; + } _return_value = os_lseek_impl(module, fd, position, how); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromPy_off_t(_return_value); exit: @@ -3426,8 +3554,9 @@ os_read(PyObject *module, PyObject *args) Py_ssize_t length; if (!PyArg_ParseTuple(args, "in:read", - &fd, &length)) + &fd, &length)) { goto exit; + } return_value = os_read_impl(module, fd, length); exit: @@ -3465,11 +3594,13 @@ os_readv(PyObject *module, PyObject *args) Py_ssize_t _return_value; if (!PyArg_ParseTuple(args, "iO:readv", - &fd, &buffers)) + &fd, &buffers)) { goto exit; + } _return_value = os_readv_impl(module, fd, buffers); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromSsize_t(_return_value); exit: @@ -3504,8 +3635,9 @@ os_pread(PyObject *module, PyObject *args) Py_off_t offset; if (!PyArg_ParseTuple(args, "iiO&:pread", - &fd, &length, Py_off_t_converter, &offset)) + &fd, &length, Py_off_t_converter, &offset)) { goto exit; + } return_value = os_pread_impl(module, fd, length, offset); exit: @@ -3535,17 +3667,20 @@ os_write(PyObject *module, PyObject *args) Py_ssize_t _return_value; if (!PyArg_ParseTuple(args, "iy*:write", - &fd, &data)) + &fd, &data)) { goto exit; + } _return_value = os_write_impl(module, fd, &data); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromSsize_t(_return_value); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -3569,12 +3704,14 @@ static PyObject * os_fstat(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"fd", NULL}; + static const char * const _keywords[] = {"fd", NULL}; + static _PyArg_Parser _parser = {"i:fstat", _keywords, 0}; int fd; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:fstat", _keywords, - &fd)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &fd)) { goto exit; + } return_value = os_fstat_impl(module, fd); exit: @@ -3603,11 +3740,13 @@ os_isatty(PyObject *module, PyObject *arg) int fd; int _return_value; - if (!PyArg_Parse(arg, "i:isatty", &fd)) + if (!PyArg_Parse(arg, "i:isatty", &fd)) { goto exit; + } _return_value = os_isatty_impl(module, fd); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyBool_FromLong((long)_return_value); exit: @@ -3665,8 +3804,9 @@ os_pipe2(PyObject *module, PyObject *arg) PyObject *return_value = NULL; int flags; - if (!PyArg_Parse(arg, "i:pipe2", &flags)) + if (!PyArg_Parse(arg, "i:pipe2", &flags)) { goto exit; + } return_value = os_pipe2_impl(module, flags); exit: @@ -3701,11 +3841,13 @@ os_writev(PyObject *module, PyObject *args) Py_ssize_t _return_value; if (!PyArg_ParseTuple(args, "iO:writev", - &fd, &buffers)) + &fd, &buffers)) { goto exit; + } _return_value = os_writev_impl(module, fd, buffers); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromSsize_t(_return_value); exit: @@ -3742,17 +3884,20 @@ os_pwrite(PyObject *module, PyObject *args) Py_ssize_t _return_value; if (!PyArg_ParseTuple(args, "iy*O&:pwrite", - &fd, &buffer, Py_off_t_converter, &offset)) + &fd, &buffer, Py_off_t_converter, &offset)) { goto exit; + } _return_value = os_pwrite_impl(module, fd, &buffer, offset); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromSsize_t(_return_value); exit: /* Cleanup for buffer */ - if (buffer.obj) + if (buffer.obj) { PyBuffer_Release(&buffer); + } return return_value; } @@ -3782,14 +3927,16 @@ static PyObject * os_mkfifo(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", "mode", "dir_fd", NULL}; + static const char * const _keywords[] = {"path", "mode", "dir_fd", NULL}; + static _PyArg_Parser _parser = {"O&|i$O&:mkfifo", _keywords, 0}; path_t path = PATH_T_INITIALIZE("mkfifo", "path", 0, 0); int mode = 438; int dir_fd = DEFAULT_DIR_FD; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|i$O&:mkfifo", _keywords, - path_converter, &path, &mode, MKFIFOAT_DIR_FD_CONVERTER, &dir_fd)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &path, &mode, MKFIFOAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; + } return_value = os_mkfifo_impl(module, &path, mode, dir_fd); exit: @@ -3832,15 +3979,17 @@ static PyObject * os_mknod(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", "mode", "device", "dir_fd", NULL}; + static const char * const _keywords[] = {"path", "mode", "device", "dir_fd", NULL}; + static _PyArg_Parser _parser = {"O&|iO&$O&:mknod", _keywords, 0}; path_t path = PATH_T_INITIALIZE("mknod", "path", 0, 0); int mode = 384; dev_t device = 0; int dir_fd = DEFAULT_DIR_FD; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|iO&$O&:mknod", _keywords, - path_converter, &path, &mode, _Py_Dev_Converter, &device, MKNODAT_DIR_FD_CONVERTER, &dir_fd)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &path, &mode, _Py_Dev_Converter, &device, MKNODAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; + } return_value = os_mknod_impl(module, &path, mode, device, dir_fd); exit: @@ -3873,11 +4022,13 @@ os_major(PyObject *module, PyObject *arg) dev_t device; unsigned int _return_value; - if (!PyArg_Parse(arg, "O&:major", _Py_Dev_Converter, &device)) + if (!PyArg_Parse(arg, "O&:major", _Py_Dev_Converter, &device)) { goto exit; + } _return_value = os_major_impl(module, device); - if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) + if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromUnsignedLong((unsigned long)_return_value); exit: @@ -3907,11 +4058,13 @@ os_minor(PyObject *module, PyObject *arg) dev_t device; unsigned int _return_value; - if (!PyArg_Parse(arg, "O&:minor", _Py_Dev_Converter, &device)) + if (!PyArg_Parse(arg, "O&:minor", _Py_Dev_Converter, &device)) { goto exit; + } _return_value = os_minor_impl(module, device); - if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) + if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromUnsignedLong((unsigned long)_return_value); exit: @@ -3943,11 +4096,13 @@ os_makedev(PyObject *module, PyObject *args) dev_t _return_value; if (!PyArg_ParseTuple(args, "ii:makedev", - &major, &minor)) + &major, &minor)) { goto exit; + } _return_value = os_makedev_impl(module, major, minor); - if ((_return_value == (dev_t)-1) && PyErr_Occurred()) + if ((_return_value == (dev_t)-1) && PyErr_Occurred()) { goto exit; + } return_value = _PyLong_FromDev(_return_value); exit: @@ -3978,8 +4133,9 @@ os_ftruncate(PyObject *module, PyObject *args) Py_off_t length; if (!PyArg_ParseTuple(args, "iO&:ftruncate", - &fd, Py_off_t_converter, &length)) + &fd, Py_off_t_converter, &length)) { goto exit; + } return_value = os_ftruncate_impl(module, fd, length); exit: @@ -4009,13 +4165,15 @@ static PyObject * os_truncate(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", "length", NULL}; + static const char * const _keywords[] = {"path", "length", NULL}; + static _PyArg_Parser _parser = {"O&O&:truncate", _keywords, 0}; path_t path = PATH_T_INITIALIZE("truncate", "path", 0, PATH_HAVE_FTRUNCATE); Py_off_t length; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&:truncate", _keywords, - path_converter, &path, Py_off_t_converter, &length)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &path, Py_off_t_converter, &length)) { goto exit; + } return_value = os_truncate_impl(module, &path, length); exit: @@ -4054,8 +4212,9 @@ os_posix_fallocate(PyObject *module, PyObject *args) Py_off_t length; if (!PyArg_ParseTuple(args, "iO&O&:posix_fallocate", - &fd, Py_off_t_converter, &offset, Py_off_t_converter, &length)) + &fd, Py_off_t_converter, &offset, Py_off_t_converter, &length)) { goto exit; + } return_value = os_posix_fallocate_impl(module, fd, offset, length); exit: @@ -4097,8 +4256,9 @@ os_posix_fadvise(PyObject *module, PyObject *args) int advice; if (!PyArg_ParseTuple(args, "iO&O&i:posix_fadvise", - &fd, Py_off_t_converter, &offset, Py_off_t_converter, &length, &advice)) + &fd, Py_off_t_converter, &offset, Py_off_t_converter, &length, &advice)) { goto exit; + } return_value = os_posix_fadvise_impl(module, fd, offset, length, advice); exit: @@ -4129,8 +4289,9 @@ os_putenv(PyObject *module, PyObject *args) PyObject *value; if (!PyArg_ParseTuple(args, "UU:putenv", - &name, &value)) + &name, &value)) { goto exit; + } return_value = os_putenv_impl(module, name, value); exit: @@ -4161,8 +4322,9 @@ os_putenv(PyObject *module, PyObject *args) PyObject *value = NULL; if (!PyArg_ParseTuple(args, "O&O&:putenv", - PyUnicode_FSConverter, &name, PyUnicode_FSConverter, &value)) + PyUnicode_FSConverter, &name, PyUnicode_FSConverter, &value)) { goto exit; + } return_value = os_putenv_impl(module, name, value); exit: @@ -4196,8 +4358,9 @@ os_unsetenv(PyObject *module, PyObject *arg) PyObject *return_value = NULL; PyObject *name = NULL; - if (!PyArg_Parse(arg, "O&:unsetenv", PyUnicode_FSConverter, &name)) + if (!PyArg_Parse(arg, "O&:unsetenv", PyUnicode_FSConverter, &name)) { goto exit; + } return_value = os_unsetenv_impl(module, name); exit: @@ -4227,8 +4390,9 @@ os_strerror(PyObject *module, PyObject *arg) PyObject *return_value = NULL; int code; - if (!PyArg_Parse(arg, "i:strerror", &code)) + if (!PyArg_Parse(arg, "i:strerror", &code)) { goto exit; + } return_value = os_strerror_impl(module, code); exit: @@ -4256,11 +4420,13 @@ os_WCOREDUMP(PyObject *module, PyObject *arg) int status; int _return_value; - if (!PyArg_Parse(arg, "i:WCOREDUMP", &status)) + if (!PyArg_Parse(arg, "i:WCOREDUMP", &status)) { goto exit; + } _return_value = os_WCOREDUMP_impl(module, status); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyBool_FromLong((long)_return_value); exit: @@ -4290,16 +4456,19 @@ static PyObject * os_WIFCONTINUED(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"status", NULL}; + static const char * const _keywords[] = {"status", NULL}; + static _PyArg_Parser _parser = {"i:WIFCONTINUED", _keywords, 0}; int status; int _return_value; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WIFCONTINUED", _keywords, - &status)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &status)) { goto exit; + } _return_value = os_WIFCONTINUED_impl(module, status); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyBool_FromLong((long)_return_value); exit: @@ -4326,16 +4495,19 @@ static PyObject * os_WIFSTOPPED(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"status", NULL}; + static const char * const _keywords[] = {"status", NULL}; + static _PyArg_Parser _parser = {"i:WIFSTOPPED", _keywords, 0}; int status; int _return_value; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WIFSTOPPED", _keywords, - &status)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &status)) { goto exit; + } _return_value = os_WIFSTOPPED_impl(module, status); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyBool_FromLong((long)_return_value); exit: @@ -4362,16 +4534,19 @@ static PyObject * os_WIFSIGNALED(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"status", NULL}; + static const char * const _keywords[] = {"status", NULL}; + static _PyArg_Parser _parser = {"i:WIFSIGNALED", _keywords, 0}; int status; int _return_value; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WIFSIGNALED", _keywords, - &status)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &status)) { goto exit; + } _return_value = os_WIFSIGNALED_impl(module, status); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyBool_FromLong((long)_return_value); exit: @@ -4398,16 +4573,19 @@ static PyObject * os_WIFEXITED(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"status", NULL}; + static const char * const _keywords[] = {"status", NULL}; + static _PyArg_Parser _parser = {"i:WIFEXITED", _keywords, 0}; int status; int _return_value; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WIFEXITED", _keywords, - &status)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &status)) { goto exit; + } _return_value = os_WIFEXITED_impl(module, status); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyBool_FromLong((long)_return_value); exit: @@ -4434,16 +4612,19 @@ static PyObject * os_WEXITSTATUS(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"status", NULL}; + static const char * const _keywords[] = {"status", NULL}; + static _PyArg_Parser _parser = {"i:WEXITSTATUS", _keywords, 0}; int status; int _return_value; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WEXITSTATUS", _keywords, - &status)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &status)) { goto exit; + } _return_value = os_WEXITSTATUS_impl(module, status); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong((long)_return_value); exit: @@ -4470,16 +4651,19 @@ static PyObject * os_WTERMSIG(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"status", NULL}; + static const char * const _keywords[] = {"status", NULL}; + static _PyArg_Parser _parser = {"i:WTERMSIG", _keywords, 0}; int status; int _return_value; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WTERMSIG", _keywords, - &status)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &status)) { goto exit; + } _return_value = os_WTERMSIG_impl(module, status); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong((long)_return_value); exit: @@ -4506,16 +4690,19 @@ static PyObject * os_WSTOPSIG(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"status", NULL}; + static const char * const _keywords[] = {"status", NULL}; + static _PyArg_Parser _parser = {"i:WSTOPSIG", _keywords, 0}; int status; int _return_value; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WSTOPSIG", _keywords, - &status)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &status)) { goto exit; + } _return_value = os_WSTOPSIG_impl(module, status); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong((long)_return_value); exit: @@ -4546,8 +4733,9 @@ os_fstatvfs(PyObject *module, PyObject *arg) PyObject *return_value = NULL; int fd; - if (!PyArg_Parse(arg, "i:fstatvfs", &fd)) + if (!PyArg_Parse(arg, "i:fstatvfs", &fd)) { goto exit; + } return_value = os_fstatvfs_impl(module, fd); exit: @@ -4578,12 +4766,14 @@ static PyObject * os_statvfs(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", NULL}; + static const char * const _keywords[] = {"path", NULL}; + static _PyArg_Parser _parser = {"O&:statvfs", _keywords, 0}; path_t path = PATH_T_INITIALIZE("statvfs", "path", 0, PATH_HAVE_FSTATVFS); - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:statvfs", _keywords, - path_converter, &path)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &path)) { goto exit; + } return_value = os_statvfs_impl(module, &path); exit: @@ -4613,12 +4803,14 @@ static PyObject * os__getdiskusage(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", NULL}; + static const char * const _keywords[] = {"path", NULL}; + static _PyArg_Parser _parser = {"u:_getdiskusage", _keywords, 0}; Py_UNICODE *path; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "u:_getdiskusage", _keywords, - &path)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &path)) { goto exit; + } return_value = os__getdiskusage_impl(module, path); exit: @@ -4652,11 +4844,13 @@ os_fpathconf(PyObject *module, PyObject *args) long _return_value; if (!PyArg_ParseTuple(args, "iO&:fpathconf", - &fd, conv_path_confname, &name)) + &fd, conv_path_confname, &name)) { goto exit; + } _return_value = os_fpathconf_impl(module, fd, name); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong(_return_value); exit: @@ -4687,17 +4881,20 @@ static PyObject * os_pathconf(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", "name", NULL}; + static const char * const _keywords[] = {"path", "name", NULL}; + static _PyArg_Parser _parser = {"O&O&:pathconf", _keywords, 0}; path_t path = PATH_T_INITIALIZE("pathconf", "path", 0, PATH_HAVE_FPATHCONF); int name; long _return_value; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&:pathconf", _keywords, - path_converter, &path, conv_path_confname, &name)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &path, conv_path_confname, &name)) { goto exit; + } _return_value = os_pathconf_impl(module, &path, name); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong(_return_value); exit: @@ -4729,8 +4926,9 @@ os_confstr(PyObject *module, PyObject *arg) PyObject *return_value = NULL; int name; - if (!PyArg_Parse(arg, "O&:confstr", conv_confstr_confname, &name)) + if (!PyArg_Parse(arg, "O&:confstr", conv_confstr_confname, &name)) { goto exit; + } return_value = os_confstr_impl(module, name); exit: @@ -4760,11 +4958,13 @@ os_sysconf(PyObject *module, PyObject *arg) int name; long _return_value; - if (!PyArg_Parse(arg, "O&:sysconf", conv_sysconf_confname, &name)) + if (!PyArg_Parse(arg, "O&:sysconf", conv_sysconf_confname, &name)) { goto exit; + } _return_value = os_sysconf_impl(module, name); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong(_return_value); exit: @@ -4839,12 +5039,14 @@ static PyObject * os_device_encoding(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"fd", NULL}; + static const char * const _keywords[] = {"fd", NULL}; + static _PyArg_Parser _parser = {"i:device_encoding", _keywords, 0}; int fd; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:device_encoding", _keywords, - &fd)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &fd)) { goto exit; + } return_value = os_device_encoding_impl(module, fd); exit: @@ -4874,8 +5076,9 @@ os_setresuid(PyObject *module, PyObject *args) uid_t suid; if (!PyArg_ParseTuple(args, "O&O&O&:setresuid", - _Py_Uid_Converter, &ruid, _Py_Uid_Converter, &euid, _Py_Uid_Converter, &suid)) + _Py_Uid_Converter, &ruid, _Py_Uid_Converter, &euid, _Py_Uid_Converter, &suid)) { goto exit; + } return_value = os_setresuid_impl(module, ruid, euid, suid); exit: @@ -4907,8 +5110,9 @@ os_setresgid(PyObject *module, PyObject *args) gid_t sgid; if (!PyArg_ParseTuple(args, "O&O&O&:setresgid", - _Py_Gid_Converter, &rgid, _Py_Gid_Converter, &egid, _Py_Gid_Converter, &sgid)) + _Py_Gid_Converter, &rgid, _Py_Gid_Converter, &egid, _Py_Gid_Converter, &sgid)) { goto exit; + } return_value = os_setresgid_impl(module, rgid, egid, sgid); exit: @@ -4985,14 +5189,16 @@ static PyObject * os_getxattr(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", "attribute", "follow_symlinks", NULL}; + static const char * const _keywords[] = {"path", "attribute", "follow_symlinks", NULL}; + static _PyArg_Parser _parser = {"O&O&|$p:getxattr", _keywords, 0}; path_t path = PATH_T_INITIALIZE("getxattr", "path", 0, 1); path_t attribute = PATH_T_INITIALIZE("getxattr", "attribute", 0, 0); int follow_symlinks = 1; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&|$p:getxattr", _keywords, - path_converter, &path, path_converter, &attribute, &follow_symlinks)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &path, path_converter, &attribute, &follow_symlinks)) { goto exit; + } return_value = os_getxattr_impl(module, &path, &attribute, follow_symlinks); exit: @@ -5031,16 +5237,18 @@ static PyObject * os_setxattr(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", "attribute", "value", "flags", "follow_symlinks", NULL}; + static const char * const _keywords[] = {"path", "attribute", "value", "flags", "follow_symlinks", NULL}; + static _PyArg_Parser _parser = {"O&O&y*|i$p:setxattr", _keywords, 0}; path_t path = PATH_T_INITIALIZE("setxattr", "path", 0, 1); path_t attribute = PATH_T_INITIALIZE("setxattr", "attribute", 0, 0); Py_buffer value = {NULL, NULL}; int flags = 0; int follow_symlinks = 1; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&y*|i$p:setxattr", _keywords, - path_converter, &path, path_converter, &attribute, &value, &flags, &follow_symlinks)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &path, path_converter, &attribute, &value, &flags, &follow_symlinks)) { goto exit; + } return_value = os_setxattr_impl(module, &path, &attribute, &value, flags, follow_symlinks); exit: @@ -5049,8 +5257,9 @@ exit: /* Cleanup for attribute */ path_cleanup(&attribute); /* Cleanup for value */ - if (value.obj) + if (value.obj) { PyBuffer_Release(&value); + } return return_value; } @@ -5081,14 +5290,16 @@ static PyObject * os_removexattr(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", "attribute", "follow_symlinks", NULL}; + static const char * const _keywords[] = {"path", "attribute", "follow_symlinks", NULL}; + static _PyArg_Parser _parser = {"O&O&|$p:removexattr", _keywords, 0}; path_t path = PATH_T_INITIALIZE("removexattr", "path", 0, 1); path_t attribute = PATH_T_INITIALIZE("removexattr", "attribute", 0, 0); int follow_symlinks = 1; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&|$p:removexattr", _keywords, - path_converter, &path, path_converter, &attribute, &follow_symlinks)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &path, path_converter, &attribute, &follow_symlinks)) { goto exit; + } return_value = os_removexattr_impl(module, &path, &attribute, follow_symlinks); exit: @@ -5126,13 +5337,15 @@ static PyObject * os_listxattr(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"path", "follow_symlinks", NULL}; + static const char * const _keywords[] = {"path", "follow_symlinks", NULL}; + static _PyArg_Parser _parser = {"|O&$p:listxattr", _keywords, 0}; path_t path = PATH_T_INITIALIZE("listxattr", "path", 1, 1); int follow_symlinks = 1; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O&$p:listxattr", _keywords, - path_converter, &path, &follow_symlinks)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + path_converter, &path, &follow_symlinks)) { goto exit; + } return_value = os_listxattr_impl(module, &path, follow_symlinks); exit: @@ -5162,8 +5375,9 @@ os_urandom(PyObject *module, PyObject *arg) PyObject *return_value = NULL; Py_ssize_t size; - if (!PyArg_Parse(arg, "n:urandom", &size)) + if (!PyArg_Parse(arg, "n:urandom", &size)) { goto exit; + } return_value = os_urandom_impl(module, size); exit: @@ -5174,7 +5388,11 @@ PyDoc_STRVAR(os_cpu_count__doc__, "cpu_count($module, /)\n" "--\n" "\n" -"Return the number of CPUs in the system; return None if indeterminable."); +"Return the number of CPUs in the system; return None if indeterminable.\n" +"\n" +"This number is not equivalent to the number of CPUs the current process can\n" +"use. The number of usable CPUs can be obtained with\n" +"``len(os.sched_getaffinity(0))``"); #define OS_CPU_COUNT_METHODDEF \ {"cpu_count", (PyCFunction)os_cpu_count, METH_NOARGS, os_cpu_count__doc__}, @@ -5207,11 +5425,13 @@ os_get_inheritable(PyObject *module, PyObject *arg) int fd; int _return_value; - if (!PyArg_Parse(arg, "i:get_inheritable", &fd)) + if (!PyArg_Parse(arg, "i:get_inheritable", &fd)) { goto exit; + } _return_value = os_get_inheritable_impl(module, fd); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyBool_FromLong((long)_return_value); exit: @@ -5238,8 +5458,9 @@ os_set_inheritable(PyObject *module, PyObject *args) int inheritable; if (!PyArg_ParseTuple(args, "ii:set_inheritable", - &fd, &inheritable)) + &fd, &inheritable)) { goto exit; + } return_value = os_set_inheritable_impl(module, fd, inheritable); exit: @@ -5267,11 +5488,13 @@ os_get_handle_inheritable(PyObject *module, PyObject *arg) Py_intptr_t handle; int _return_value; - if (!PyArg_Parse(arg, "" _Py_PARSE_INTPTR ":get_handle_inheritable", &handle)) + if (!PyArg_Parse(arg, "" _Py_PARSE_INTPTR ":get_handle_inheritable", &handle)) { goto exit; + } _return_value = os_get_handle_inheritable_impl(module, handle); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyBool_FromLong((long)_return_value); exit: @@ -5303,8 +5526,9 @@ os_set_handle_inheritable(PyObject *module, PyObject *args) int inheritable; if (!PyArg_ParseTuple(args, "" _Py_PARSE_INTPTR "p:set_handle_inheritable", - &handle, &inheritable)) + &handle, &inheritable)) { goto exit; + } return_value = os_set_handle_inheritable_impl(module, handle, inheritable); exit: @@ -5313,6 +5537,40 @@ exit: #endif /* defined(MS_WINDOWS) */ +PyDoc_STRVAR(os_fspath__doc__, +"fspath($module, /, path)\n" +"--\n" +"\n" +"Return the file system path representation of the object.\n" +"\n" +"If the object is str or bytes, then allow it to pass through as-is. If the\n" +"object defines __fspath__(), then return the result of that method. All other\n" +"types raise a TypeError."); + +#define OS_FSPATH_METHODDEF \ + {"fspath", (PyCFunction)os_fspath, METH_VARARGS|METH_KEYWORDS, os_fspath__doc__}, + +static PyObject * +os_fspath_impl(PyObject *module, PyObject *path); + +static PyObject * +os_fspath(PyObject *module, PyObject *args, PyObject *kwargs) +{ + PyObject *return_value = NULL; + static const char * const _keywords[] = {"path", NULL}; + static _PyArg_Parser _parser = {"O:fspath", _keywords, 0}; + PyObject *path; + + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &path)) { + goto exit; + } + return_value = os_fspath_impl(module, path); + +exit: + return return_value; +} + #ifndef OS_TTYNAME_METHODDEF #define OS_TTYNAME_METHODDEF #endif /* !defined(OS_TTYNAME_METHODDEF) */ @@ -5784,4 +6042,4 @@ exit: #ifndef OS_SET_HANDLE_INHERITABLE_METHODDEF #define OS_SET_HANDLE_INHERITABLE_METHODDEF #endif /* !defined(OS_SET_HANDLE_INHERITABLE_METHODDEF) */ -/*[clinic end generated code: output=c27221987f987cf3 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=97180b6734421a7d input=a9049054013a1b77]*/ diff --git a/Modules/clinic/pwdmodule.c.h b/Modules/clinic/pwdmodule.c.h index cb191a0..f9e0644 100644 --- a/Modules/clinic/pwdmodule.c.h +++ b/Modules/clinic/pwdmodule.c.h @@ -33,8 +33,9 @@ pwd_getpwnam(PyObject *module, PyObject *arg_) PyObject *return_value = NULL; PyObject *arg; - if (!PyArg_Parse(arg_, "U:getpwnam", &arg)) + if (!PyArg_Parse(arg_, "U:getpwnam", &arg)) { goto exit; + } return_value = pwd_getpwnam_impl(module, arg); exit: @@ -68,4 +69,4 @@ pwd_getpwall(PyObject *module, PyObject *Py_UNUSED(ignored)) #ifndef PWD_GETPWALL_METHODDEF #define PWD_GETPWALL_METHODDEF #endif /* !defined(PWD_GETPWALL_METHODDEF) */ -/*[clinic end generated code: output=d0ea1c5c832f0c1a input=a9049054013a1b77]*/ +/*[clinic end generated code: output=fc41d8d88ec206d8 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/pyexpat.c.h b/Modules/clinic/pyexpat.c.h index c5b5c71..8a03f67 100644 --- a/Modules/clinic/pyexpat.c.h +++ b/Modules/clinic/pyexpat.c.h @@ -25,8 +25,9 @@ pyexpat_xmlparser_Parse(xmlparseobject *self, PyObject *args) int isfinal = 0; if (!PyArg_ParseTuple(args, "O|i:Parse", - &data, &isfinal)) + &data, &isfinal)) { goto exit; + } return_value = pyexpat_xmlparser_Parse_impl(self, data, isfinal); exit: @@ -60,8 +61,9 @@ pyexpat_xmlparser_SetBase(xmlparseobject *self, PyObject *arg) PyObject *return_value = NULL; const char *base; - if (!PyArg_Parse(arg, "s:SetBase", &base)) + if (!PyArg_Parse(arg, "s:SetBase", &base)) { goto exit; + } return_value = pyexpat_xmlparser_SetBase_impl(self, base); exit: @@ -129,8 +131,9 @@ pyexpat_xmlparser_ExternalEntityParserCreate(xmlparseobject *self, PyObject *arg const char *encoding = NULL; if (!PyArg_ParseTuple(args, "z|s:ExternalEntityParserCreate", - &context, &encoding)) + &context, &encoding)) { goto exit; + } return_value = pyexpat_xmlparser_ExternalEntityParserCreate_impl(self, context, encoding); exit: @@ -160,8 +163,9 @@ pyexpat_xmlparser_SetParamEntityParsing(xmlparseobject *self, PyObject *arg) PyObject *return_value = NULL; int flag; - if (!PyArg_Parse(arg, "i:SetParamEntityParsing", &flag)) + if (!PyArg_Parse(arg, "i:SetParamEntityParsing", &flag)) { goto exit; + } return_value = pyexpat_xmlparser_SetParamEntityParsing_impl(self, flag); exit: @@ -193,8 +197,9 @@ pyexpat_xmlparser_UseForeignDTD(xmlparseobject *self, PyObject *args) int flag = 1; if (!PyArg_ParseTuple(args, "|p:UseForeignDTD", - &flag)) + &flag)) { goto exit; + } return_value = pyexpat_xmlparser_UseForeignDTD_impl(self, flag); exit: @@ -238,14 +243,16 @@ static PyObject * pyexpat_ParserCreate(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"encoding", "namespace_separator", "intern", NULL}; + static const char * const _keywords[] = {"encoding", "namespace_separator", "intern", NULL}; + static _PyArg_Parser _parser = {"|zzO:ParserCreate", _keywords, 0}; const char *encoding = NULL; const char *namespace_separator = NULL; PyObject *intern = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|zzO:ParserCreate", _keywords, - &encoding, &namespace_separator, &intern)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &encoding, &namespace_separator, &intern)) { goto exit; + } return_value = pyexpat_ParserCreate_impl(module, encoding, namespace_separator, intern); exit: @@ -270,8 +277,9 @@ pyexpat_ErrorString(PyObject *module, PyObject *arg) PyObject *return_value = NULL; long code; - if (!PyArg_Parse(arg, "l:ErrorString", &code)) + if (!PyArg_Parse(arg, "l:ErrorString", &code)) { goto exit; + } return_value = pyexpat_ErrorString_impl(module, code); exit: @@ -281,4 +289,4 @@ exit: #ifndef PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF #define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF #endif /* !defined(PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF) */ -/*[clinic end generated code: output=d479cfab607e9dc8 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=93cfe662f2bc48e5 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/sha1module.c.h b/Modules/clinic/sha1module.c.h index 5b8db80..1972762 100644 --- a/Modules/clinic/sha1module.c.h +++ b/Modules/clinic/sha1module.c.h @@ -81,15 +81,17 @@ static PyObject * _sha1_sha1(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"string", NULL}; + static const char * const _keywords[] = {"string", NULL}; + static _PyArg_Parser _parser = {"|O:sha1", _keywords, 0}; PyObject *string = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:sha1", _keywords, - &string)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &string)) { goto exit; + } return_value = _sha1_sha1_impl(module, string); exit: return return_value; } -/*[clinic end generated code: output=0b6a194fbb0b94f2 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=549a5d08c248337d input=a9049054013a1b77]*/ diff --git a/Modules/clinic/sha256module.c.h b/Modules/clinic/sha256module.c.h index 661569c..4239ab8 100644 --- a/Modules/clinic/sha256module.c.h +++ b/Modules/clinic/sha256module.c.h @@ -81,12 +81,14 @@ static PyObject * _sha256_sha256(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"string", NULL}; + static const char * const _keywords[] = {"string", NULL}; + static _PyArg_Parser _parser = {"|O:sha256", _keywords, 0}; PyObject *string = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:sha256", _keywords, - &string)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &string)) { goto exit; + } return_value = _sha256_sha256_impl(module, string); exit: @@ -109,15 +111,17 @@ static PyObject * _sha256_sha224(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"string", NULL}; + static const char * const _keywords[] = {"string", NULL}; + static _PyArg_Parser _parser = {"|O:sha224", _keywords, 0}; PyObject *string = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:sha224", _keywords, - &string)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &string)) { goto exit; + } return_value = _sha256_sha224_impl(module, string); exit: return return_value; } -/*[clinic end generated code: output=5a1fc5480e399f95 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=a1296ba6d0780051 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/sha512module.c.h b/Modules/clinic/sha512module.c.h index d64c2a4..78f7743 100644 --- a/Modules/clinic/sha512module.c.h +++ b/Modules/clinic/sha512module.c.h @@ -99,12 +99,14 @@ static PyObject * _sha512_sha512(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"string", NULL}; + static const char * const _keywords[] = {"string", NULL}; + static _PyArg_Parser _parser = {"|O:sha512", _keywords, 0}; PyObject *string = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:sha512", _keywords, - &string)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &string)) { goto exit; + } return_value = _sha512_sha512_impl(module, string); exit: @@ -131,12 +133,14 @@ static PyObject * _sha512_sha384(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"string", NULL}; + static const char * const _keywords[] = {"string", NULL}; + static _PyArg_Parser _parser = {"|O:sha384", _keywords, 0}; PyObject *string = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:sha384", _keywords, - &string)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &string)) { goto exit; + } return_value = _sha512_sha384_impl(module, string); exit: @@ -168,4 +172,4 @@ exit: #ifndef _SHA512_SHA384_METHODDEF #define _SHA512_SHA384_METHODDEF #endif /* !defined(_SHA512_SHA384_METHODDEF) */ -/*[clinic end generated code: output=bb87f494df50ffc0 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=cf0da76cb603d1bf input=a9049054013a1b77]*/ diff --git a/Modules/clinic/signalmodule.c.h b/Modules/clinic/signalmodule.c.h index c8f4cd5..f8d5bd9 100644 --- a/Modules/clinic/signalmodule.c.h +++ b/Modules/clinic/signalmodule.c.h @@ -23,11 +23,13 @@ signal_alarm(PyObject *module, PyObject *arg) int seconds; long _return_value; - if (!PyArg_Parse(arg, "i:alarm", &seconds)) + if (!PyArg_Parse(arg, "i:alarm", &seconds)) { goto exit; + } _return_value = signal_alarm_impl(module, seconds); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong(_return_value); exit: @@ -85,8 +87,9 @@ signal_signal(PyObject *module, PyObject *args) PyObject *handler; if (!PyArg_ParseTuple(args, "iO:signal", - &signalnum, &handler)) + &signalnum, &handler)) { goto exit; + } return_value = signal_signal_impl(module, signalnum, handler); exit: @@ -117,8 +120,9 @@ signal_getsignal(PyObject *module, PyObject *arg) PyObject *return_value = NULL; int signalnum; - if (!PyArg_Parse(arg, "i:getsignal", &signalnum)) + if (!PyArg_Parse(arg, "i:getsignal", &signalnum)) { goto exit; + } return_value = signal_getsignal_impl(module, signalnum); exit: @@ -150,8 +154,9 @@ signal_siginterrupt(PyObject *module, PyObject *args) int flag; if (!PyArg_ParseTuple(args, "ii:siginterrupt", - &signalnum, &flag)) + &signalnum, &flag)) { goto exit; + } return_value = signal_siginterrupt_impl(module, signalnum, flag); exit: @@ -189,8 +194,9 @@ signal_setitimer(PyObject *module, PyObject *args) double interval = 0.0; if (!PyArg_ParseTuple(args, "id|d:setitimer", - &which, &seconds, &interval)) + &which, &seconds, &interval)) { goto exit; + } return_value = signal_setitimer_impl(module, which, seconds, interval); exit: @@ -219,8 +225,9 @@ signal_getitimer(PyObject *module, PyObject *arg) PyObject *return_value = NULL; int which; - if (!PyArg_Parse(arg, "i:getitimer", &which)) + if (!PyArg_Parse(arg, "i:getitimer", &which)) { goto exit; + } return_value = signal_getitimer_impl(module, which); exit: @@ -251,8 +258,9 @@ signal_pthread_sigmask(PyObject *module, PyObject *args) PyObject *mask; if (!PyArg_ParseTuple(args, "iO:pthread_sigmask", - &how, &mask)) + &how, &mask)) { goto exit; + } return_value = signal_pthread_sigmask_impl(module, how, mask); exit: @@ -344,8 +352,9 @@ signal_sigtimedwait(PyObject *module, PyObject *args) if (!PyArg_UnpackTuple(args, "sigtimedwait", 2, 2, - &sigset, &timeout_obj)) + &sigset, &timeout_obj)) { goto exit; + } return_value = signal_sigtimedwait_impl(module, sigset, timeout_obj); exit: @@ -376,8 +385,9 @@ signal_pthread_kill(PyObject *module, PyObject *args) int signalnum; if (!PyArg_ParseTuple(args, "li:pthread_kill", - &thread_id, &signalnum)) + &thread_id, &signalnum)) { goto exit; + } return_value = signal_pthread_kill_impl(module, thread_id, signalnum); exit: @@ -429,4 +439,4 @@ exit: #ifndef SIGNAL_PTHREAD_KILL_METHODDEF #define SIGNAL_PTHREAD_KILL_METHODDEF #endif /* !defined(SIGNAL_PTHREAD_KILL_METHODDEF) */ -/*[clinic end generated code: output=dafa598412bfb8d2 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=c6990ef0d0ba72b6 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/spwdmodule.c.h b/Modules/clinic/spwdmodule.c.h index e26acf1..b2479ff 100644 --- a/Modules/clinic/spwdmodule.c.h +++ b/Modules/clinic/spwdmodule.c.h @@ -24,8 +24,9 @@ spwd_getspnam(PyObject *module, PyObject *arg_) PyObject *return_value = NULL; PyObject *arg; - if (!PyArg_Parse(arg_, "U:getspnam", &arg)) + if (!PyArg_Parse(arg_, "U:getspnam", &arg)) { goto exit; + } return_value = spwd_getspnam_impl(module, arg); exit: @@ -65,4 +66,4 @@ spwd_getspall(PyObject *module, PyObject *Py_UNUSED(ignored)) #ifndef SPWD_GETSPALL_METHODDEF #define SPWD_GETSPALL_METHODDEF #endif /* !defined(SPWD_GETSPALL_METHODDEF) */ -/*[clinic end generated code: output=510f681b36f54c30 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=07cd8af0afd77fe7 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/unicodedata.c.h b/Modules/clinic/unicodedata.c.h index d520c1e..d481ccb 100644 --- a/Modules/clinic/unicodedata.c.h +++ b/Modules/clinic/unicodedata.c.h @@ -27,8 +27,9 @@ unicodedata_UCD_decimal(PyObject *self, PyObject *args) PyObject *default_value = NULL; if (!PyArg_ParseTuple(args, "C|O:decimal", - &chr, &default_value)) + &chr, &default_value)) { goto exit; + } return_value = unicodedata_UCD_decimal_impl(self, chr, default_value); exit: @@ -59,8 +60,9 @@ unicodedata_UCD_digit(PyObject *self, PyObject *args) PyObject *default_value = NULL; if (!PyArg_ParseTuple(args, "C|O:digit", - &chr, &default_value)) + &chr, &default_value)) { goto exit; + } return_value = unicodedata_UCD_digit_impl(self, chr, default_value); exit: @@ -92,8 +94,9 @@ unicodedata_UCD_numeric(PyObject *self, PyObject *args) PyObject *default_value = NULL; if (!PyArg_ParseTuple(args, "C|O:numeric", - &chr, &default_value)) + &chr, &default_value)) { goto exit; + } return_value = unicodedata_UCD_numeric_impl(self, chr, default_value); exit: @@ -118,8 +121,9 @@ unicodedata_UCD_category(PyObject *self, PyObject *arg) PyObject *return_value = NULL; int chr; - if (!PyArg_Parse(arg, "C:category", &chr)) + if (!PyArg_Parse(arg, "C:category", &chr)) { goto exit; + } return_value = unicodedata_UCD_category_impl(self, chr); exit: @@ -146,8 +150,9 @@ unicodedata_UCD_bidirectional(PyObject *self, PyObject *arg) PyObject *return_value = NULL; int chr; - if (!PyArg_Parse(arg, "C:bidirectional", &chr)) + if (!PyArg_Parse(arg, "C:bidirectional", &chr)) { goto exit; + } return_value = unicodedata_UCD_bidirectional_impl(self, chr); exit: @@ -175,11 +180,13 @@ unicodedata_UCD_combining(PyObject *self, PyObject *arg) int chr; int _return_value; - if (!PyArg_Parse(arg, "C:combining", &chr)) + if (!PyArg_Parse(arg, "C:combining", &chr)) { goto exit; + } _return_value = unicodedata_UCD_combining_impl(self, chr); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong((long)_return_value); exit: @@ -208,11 +215,13 @@ unicodedata_UCD_mirrored(PyObject *self, PyObject *arg) int chr; int _return_value; - if (!PyArg_Parse(arg, "C:mirrored", &chr)) + if (!PyArg_Parse(arg, "C:mirrored", &chr)) { goto exit; + } _return_value = unicodedata_UCD_mirrored_impl(self, chr); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong((long)_return_value); exit: @@ -237,8 +246,9 @@ unicodedata_UCD_east_asian_width(PyObject *self, PyObject *arg) PyObject *return_value = NULL; int chr; - if (!PyArg_Parse(arg, "C:east_asian_width", &chr)) + if (!PyArg_Parse(arg, "C:east_asian_width", &chr)) { goto exit; + } return_value = unicodedata_UCD_east_asian_width_impl(self, chr); exit: @@ -265,8 +275,9 @@ unicodedata_UCD_decomposition(PyObject *self, PyObject *arg) PyObject *return_value = NULL; int chr; - if (!PyArg_Parse(arg, "C:decomposition", &chr)) + if (!PyArg_Parse(arg, "C:decomposition", &chr)) { goto exit; + } return_value = unicodedata_UCD_decomposition_impl(self, chr); exit: @@ -296,8 +307,9 @@ unicodedata_UCD_normalize(PyObject *self, PyObject *args) PyObject *input; if (!PyArg_ParseTuple(args, "sO!:normalize", - &form, &PyUnicode_Type, &input)) + &form, &PyUnicode_Type, &input)) { goto exit; + } return_value = unicodedata_UCD_normalize_impl(self, form, input); exit: @@ -327,8 +339,9 @@ unicodedata_UCD_name(PyObject *self, PyObject *args) PyObject *default_value = NULL; if (!PyArg_ParseTuple(args, "C|O:name", - &chr, &default_value)) + &chr, &default_value)) { goto exit; + } return_value = unicodedata_UCD_name_impl(self, chr, default_value); exit: @@ -358,11 +371,12 @@ unicodedata_UCD_lookup(PyObject *self, PyObject *arg) const char *name; Py_ssize_clean_t name_length; - if (!PyArg_Parse(arg, "s#:lookup", &name, &name_length)) + if (!PyArg_Parse(arg, "s#:lookup", &name, &name_length)) { goto exit; + } return_value = unicodedata_UCD_lookup_impl(self, name, name_length); exit: return return_value; } -/*[clinic end generated code: output=4f8da33c6bc6efc9 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=5313ce129da87b2f input=a9049054013a1b77]*/ diff --git a/Modules/clinic/zlibmodule.c.h b/Modules/clinic/zlibmodule.c.h index b1af7ce..172308a 100644 --- a/Modules/clinic/zlibmodule.c.h +++ b/Modules/clinic/zlibmodule.c.h @@ -3,44 +3,48 @@ preserve [clinic start generated code]*/ PyDoc_STRVAR(zlib_compress__doc__, -"compress($module, bytes, level=Z_DEFAULT_COMPRESSION, /)\n" +"compress($module, data, /, level=Z_DEFAULT_COMPRESSION)\n" "--\n" "\n" "Returns a bytes object containing compressed data.\n" "\n" -" bytes\n" +" data\n" " Binary data to be compressed.\n" " level\n" -" Compression level, in 0-9."); +" Compression level, in 0-9 or -1."); #define ZLIB_COMPRESS_METHODDEF \ - {"compress", (PyCFunction)zlib_compress, METH_VARARGS, zlib_compress__doc__}, + {"compress", (PyCFunction)zlib_compress, METH_VARARGS|METH_KEYWORDS, zlib_compress__doc__}, static PyObject * -zlib_compress_impl(PyObject *module, Py_buffer *bytes, int level); +zlib_compress_impl(PyObject *module, Py_buffer *data, int level); static PyObject * -zlib_compress(PyObject *module, PyObject *args) +zlib_compress(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - Py_buffer bytes = {NULL, NULL}; + static const char * const _keywords[] = {"", "level", NULL}; + static _PyArg_Parser _parser = {"y*|i:compress", _keywords, 0}; + Py_buffer data = {NULL, NULL}; int level = Z_DEFAULT_COMPRESSION; - if (!PyArg_ParseTuple(args, "y*|i:compress", - &bytes, &level)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &data, &level)) { goto exit; - return_value = zlib_compress_impl(module, &bytes, level); + } + return_value = zlib_compress_impl(module, &data, level); exit: - /* Cleanup for bytes */ - if (bytes.obj) - PyBuffer_Release(&bytes); + /* Cleanup for data */ + if (data.obj) { + PyBuffer_Release(&data); + } return return_value; } PyDoc_STRVAR(zlib_decompress__doc__, -"decompress($module, data, wbits=MAX_WBITS, bufsize=DEF_BUF_SIZE, /)\n" +"decompress($module, data, /, wbits=MAX_WBITS, bufsize=DEF_BUF_SIZE)\n" "--\n" "\n" "Returns a bytes object containing the uncompressed data.\n" @@ -53,29 +57,33 @@ PyDoc_STRVAR(zlib_decompress__doc__, " The initial output buffer size."); #define ZLIB_DECOMPRESS_METHODDEF \ - {"decompress", (PyCFunction)zlib_decompress, METH_VARARGS, zlib_decompress__doc__}, + {"decompress", (PyCFunction)zlib_decompress, METH_VARARGS|METH_KEYWORDS, zlib_decompress__doc__}, static PyObject * zlib_decompress_impl(PyObject *module, Py_buffer *data, int wbits, Py_ssize_t bufsize); static PyObject * -zlib_decompress(PyObject *module, PyObject *args) +zlib_decompress(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; + static const char * const _keywords[] = {"", "wbits", "bufsize", NULL}; + static _PyArg_Parser _parser = {"y*|iO&:decompress", _keywords, 0}; Py_buffer data = {NULL, NULL}; int wbits = MAX_WBITS; Py_ssize_t bufsize = DEF_BUF_SIZE; - if (!PyArg_ParseTuple(args, "y*|iO&:decompress", - &data, &wbits, ssize_t_converter, &bufsize)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &data, &wbits, ssize_t_converter, &bufsize)) { goto exit; + } return_value = zlib_decompress_impl(module, &data, wbits, bufsize); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -121,7 +129,8 @@ static PyObject * zlib_compressobj(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"level", "method", "wbits", "memLevel", "strategy", "zdict", NULL}; + static const char * const _keywords[] = {"level", "method", "wbits", "memLevel", "strategy", "zdict", NULL}; + static _PyArg_Parser _parser = {"|iiiiiy*:compressobj", _keywords, 0}; int level = Z_DEFAULT_COMPRESSION; int method = DEFLATED; int wbits = MAX_WBITS; @@ -129,15 +138,17 @@ zlib_compressobj(PyObject *module, PyObject *args, PyObject *kwargs) int strategy = Z_DEFAULT_STRATEGY; Py_buffer zdict = {NULL, NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|iiiiiy*:compressobj", _keywords, - &level, &method, &wbits, &memLevel, &strategy, &zdict)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &level, &method, &wbits, &memLevel, &strategy, &zdict)) { goto exit; + } return_value = zlib_compressobj_impl(module, level, method, wbits, memLevel, strategy, &zdict); exit: /* Cleanup for zdict */ - if (zdict.obj) + if (zdict.obj) { PyBuffer_Release(&zdict); + } return return_value; } @@ -164,13 +175,15 @@ static PyObject * zlib_decompressobj(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"wbits", "zdict", NULL}; + static const char * const _keywords[] = {"wbits", "zdict", NULL}; + static _PyArg_Parser _parser = {"|iO:decompressobj", _keywords, 0}; int wbits = MAX_WBITS; PyObject *zdict = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|iO:decompressobj", _keywords, - &wbits, &zdict)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &wbits, &zdict)) { goto exit; + } return_value = zlib_decompressobj_impl(module, wbits, zdict); exit: @@ -202,20 +215,22 @@ zlib_Compress_compress(compobject *self, PyObject *arg) PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:compress", &data)) + if (!PyArg_Parse(arg, "y*:compress", &data)) { goto exit; + } return_value = zlib_Compress_compress_impl(self, &data); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } PyDoc_STRVAR(zlib_Decompress_decompress__doc__, -"decompress($self, data, max_length=0, /)\n" +"decompress($self, data, /, max_length=0)\n" "--\n" "\n" "Return a bytes object containing the decompressed version of the data.\n" @@ -232,28 +247,32 @@ PyDoc_STRVAR(zlib_Decompress_decompress__doc__, "Call the flush() method to clear these buffers."); #define ZLIB_DECOMPRESS_DECOMPRESS_METHODDEF \ - {"decompress", (PyCFunction)zlib_Decompress_decompress, METH_VARARGS, zlib_Decompress_decompress__doc__}, + {"decompress", (PyCFunction)zlib_Decompress_decompress, METH_VARARGS|METH_KEYWORDS, zlib_Decompress_decompress__doc__}, static PyObject * zlib_Decompress_decompress_impl(compobject *self, Py_buffer *data, Py_ssize_t max_length); static PyObject * -zlib_Decompress_decompress(compobject *self, PyObject *args) +zlib_Decompress_decompress(compobject *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; + static const char * const _keywords[] = {"", "max_length", NULL}; + static _PyArg_Parser _parser = {"y*|O&:decompress", _keywords, 0}; Py_buffer data = {NULL, NULL}; Py_ssize_t max_length = 0; - if (!PyArg_ParseTuple(args, "y*|O&:decompress", - &data, ssize_t_converter, &max_length)) + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &data, ssize_t_converter, &max_length)) { goto exit; + } return_value = zlib_Decompress_decompress_impl(self, &data, max_length); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -283,8 +302,9 @@ zlib_Compress_flush(compobject *self, PyObject *args) int mode = Z_FINISH; if (!PyArg_ParseTuple(args, "|i:flush", - &mode)) + &mode)) { goto exit; + } return_value = zlib_Compress_flush_impl(self, mode); exit: @@ -357,8 +377,9 @@ zlib_Decompress_flush(compobject *self, PyObject *args) Py_ssize_t length = DEF_BUF_SIZE; if (!PyArg_ParseTuple(args, "|O&:flush", - ssize_t_converter, &length)) + ssize_t_converter, &length)) { goto exit; + } return_value = zlib_Decompress_flush_impl(self, length); exit: @@ -390,14 +411,16 @@ zlib_adler32(PyObject *module, PyObject *args) unsigned int value = 1; if (!PyArg_ParseTuple(args, "y*|I:adler32", - &data, &value)) + &data, &value)) { goto exit; + } return_value = zlib_adler32_impl(module, &data, value); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -427,14 +450,16 @@ zlib_crc32(PyObject *module, PyObject *args) unsigned int value = 0; if (!PyArg_ParseTuple(args, "y*|I:crc32", - &data, &value)) + &data, &value)) { goto exit; + } return_value = zlib_crc32_impl(module, &data, value); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -442,4 +467,4 @@ exit: #ifndef ZLIB_COMPRESS_COPY_METHODDEF #define ZLIB_COMPRESS_COPY_METHODDEF #endif /* !defined(ZLIB_COMPRESS_COPY_METHODDEF) */ -/*[clinic end generated code: output=7711ef02d1d5776c input=a9049054013a1b77]*/ +/*[clinic end generated code: output=48911ef429b65903 input=a9049054013a1b77]*/ |