summaryrefslogtreecommitdiffstats
path: root/Modules/clinic
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2019-03-14 08:32:22 (GMT)
committerGitHub <noreply@github.com>2019-03-14 08:32:22 (GMT)
commit3191391515824fa7f3c573d807f1034c6a28fab3 (patch)
treeff8213b07b206de4df88dc352ee957ce68f0f2de /Modules/clinic
parent2c0d3f454705bb5ccf5f6189f3cf77bbae4f056b (diff)
downloadcpython-3191391515824fa7f3c573d807f1034c6a28fab3.zip
cpython-3191391515824fa7f3c573d807f1034c6a28fab3.tar.gz
cpython-3191391515824fa7f3c573d807f1034c6a28fab3.tar.bz2
bpo-36127: Argument Clinic: inline parsing code for keyword parameters. (GH-12058)
Diffstat (limited to 'Modules/clinic')
-rw-r--r--Modules/clinic/_asynciomodule.c.h145
-rw-r--r--Modules/clinic/_bz2module.c.h38
-rw-r--r--Modules/clinic/_codecsmodule.c.h90
-rw-r--r--Modules/clinic/_cursesmodule.c.h46
-rw-r--r--Modules/clinic/_datetimemodule.c.h15
-rw-r--r--Modules/clinic/_elementtree.c.h157
-rw-r--r--Modules/clinic/_hashopenssl.c.h183
-rw-r--r--Modules/clinic/_lzmamodule.c.h73
-rw-r--r--Modules/clinic/_opcode.c.h30
-rw-r--r--Modules/clinic/_pickle.c.h243
-rw-r--r--Modules/clinic/_queuemodule.c.h55
-rw-r--r--Modules/clinic/_sre.c.h489
-rw-r--r--Modules/clinic/_ssl.c.h248
-rw-r--r--Modules/clinic/_struct.c.h87
-rw-r--r--Modules/clinic/binascii.c.h138
-rw-r--r--Modules/clinic/cmathmodule.c.h35
-rw-r--r--Modules/clinic/gcmodule.c.h38
-rw-r--r--Modules/clinic/grpmodule.c.h25
-rw-r--r--Modules/clinic/itertoolsmodule.c.h146
-rw-r--r--Modules/clinic/mathmodule.c.h49
-rw-r--r--Modules/clinic/md5module.c.h15
-rw-r--r--Modules/clinic/posixmodule.c.h1551
-rw-r--r--Modules/clinic/pyexpat.c.h61
-rw-r--r--Modules/clinic/selectmodule.c.h119
-rw-r--r--Modules/clinic/sha1module.c.h15
-rw-r--r--Modules/clinic/sha256module.c.h28
-rw-r--r--Modules/clinic/sha512module.c.h28
-rw-r--r--Modules/clinic/zlibmodule.c.h204
28 files changed, 3816 insertions, 535 deletions
diff --git a/Modules/clinic/_asynciomodule.c.h b/Modules/clinic/_asynciomodule.c.h
index 860b57f..87669f7 100644
--- a/Modules/clinic/_asynciomodule.c.h
+++ b/Modules/clinic/_asynciomodule.c.h
@@ -27,13 +27,22 @@ _asyncio_Future___init__(PyObject *self, PyObject *args, PyObject *kwargs)
{
int return_value = -1;
static const char * const _keywords[] = {"loop", NULL};
- static _PyArg_Parser _parser = {"|$O:Future", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "Future", 0};
+ PyObject *argsbuf[1];
+ PyObject * const *fastargs;
+ Py_ssize_t nargs = PyTuple_GET_SIZE(args);
+ Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0;
PyObject *loop = Py_None;
- if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
- &loop)) {
+ fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 0, 0, argsbuf);
+ if (!fastargs) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ loop = fastargs[0];
+skip_optional_kwonly:
return_value = _asyncio_Future___init___impl((FutureObj *)self, loop);
exit:
@@ -131,14 +140,22 @@ _asyncio_Future_add_done_callback(FutureObj *self, PyObject *const *args, Py_ssi
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"", "context", NULL};
- static _PyArg_Parser _parser = {"O|$O:add_done_callback", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "add_done_callback", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *fn;
PyObject *context = NULL;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &fn, &context)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ fn = args[0];
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ context = args[1];
+skip_optional_kwonly:
return_value = _asyncio_Future_add_done_callback_impl(self, fn, context);
exit:
@@ -267,15 +284,31 @@ _asyncio_Task___init__(PyObject *self, PyObject *args, PyObject *kwargs)
{
int return_value = -1;
static const char * const _keywords[] = {"coro", "loop", "name", NULL};
- static _PyArg_Parser _parser = {"O|$OO:Task", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "Task", 0};
+ PyObject *argsbuf[3];
+ PyObject * const *fastargs;
+ Py_ssize_t nargs = PyTuple_GET_SIZE(args);
+ Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 1;
PyObject *coro;
PyObject *loop = Py_None;
PyObject *name = Py_None;
- if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
- &coro, &loop, &name)) {
+ fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 1, 0, argsbuf);
+ if (!fastargs) {
goto exit;
}
+ coro = fastargs[0];
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (fastargs[1]) {
+ loop = fastargs[1];
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ name = fastargs[2];
+skip_optional_kwonly:
return_value = _asyncio_Task___init___impl((TaskObj *)self, coro, loop, name);
exit:
@@ -303,13 +336,20 @@ _asyncio_Task_current_task(PyTypeObject *type, PyObject *const *args, Py_ssize_t
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"loop", NULL};
- static _PyArg_Parser _parser = {"|O:current_task", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "current_task", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *loop = Py_None;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &loop)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ loop = args[0];
+skip_optional_pos:
return_value = _asyncio_Task_current_task_impl(type, loop);
exit:
@@ -335,13 +375,20 @@ _asyncio_Task_all_tasks(PyTypeObject *type, PyObject *const *args, Py_ssize_t na
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"loop", NULL};
- static _PyArg_Parser _parser = {"|O:all_tasks", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "all_tasks", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *loop = Py_None;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &loop)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ loop = args[0];
+skip_optional_pos:
return_value = _asyncio_Task_all_tasks_impl(type, loop);
exit:
@@ -435,13 +482,20 @@ _asyncio_Task_get_stack(TaskObj *self, PyObject *const *args, Py_ssize_t nargs,
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"limit", NULL};
- static _PyArg_Parser _parser = {"|$O:get_stack", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "get_stack", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *limit = Py_None;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &limit)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 0, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ limit = args[0];
+skip_optional_kwonly:
return_value = _asyncio_Task_get_stack_impl(self, limit);
exit:
@@ -472,14 +526,27 @@ _asyncio_Task_print_stack(TaskObj *self, PyObject *const *args, Py_ssize_t nargs
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"limit", "file", NULL};
- static _PyArg_Parser _parser = {"|$OO:print_stack", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "print_stack", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *limit = Py_None;
PyObject *file = Py_None;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &limit, &file)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 0, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (args[0]) {
+ limit = args[0];
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ file = args[1];
+skip_optional_kwonly:
return_value = _asyncio_Task_print_stack_impl(self, limit, file);
exit:
@@ -624,13 +691,15 @@ _asyncio__register_task(PyObject *module, PyObject *const *args, Py_ssize_t narg
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"task", NULL};
- static _PyArg_Parser _parser = {"O:_register_task", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "_register_task", 0};
+ PyObject *argsbuf[1];
PyObject *task;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &task)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ task = args[0];
return_value = _asyncio__register_task_impl(module, task);
exit:
@@ -656,13 +725,15 @@ _asyncio__unregister_task(PyObject *module, PyObject *const *args, Py_ssize_t na
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"task", NULL};
- static _PyArg_Parser _parser = {"O:_unregister_task", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "_unregister_task", 0};
+ PyObject *argsbuf[1];
PyObject *task;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &task)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ task = args[0];
return_value = _asyncio__unregister_task_impl(module, task);
exit:
@@ -690,14 +761,17 @@ _asyncio__enter_task(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"loop", "task", NULL};
- static _PyArg_Parser _parser = {"OO:_enter_task", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "_enter_task", 0};
+ PyObject *argsbuf[2];
PyObject *loop;
PyObject *task;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &loop, &task)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ loop = args[0];
+ task = args[1];
return_value = _asyncio__enter_task_impl(module, loop, task);
exit:
@@ -725,17 +799,20 @@ _asyncio__leave_task(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"loop", "task", NULL};
- static _PyArg_Parser _parser = {"OO:_leave_task", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "_leave_task", 0};
+ PyObject *argsbuf[2];
PyObject *loop;
PyObject *task;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &loop, &task)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ loop = args[0];
+ task = args[1];
return_value = _asyncio__leave_task_impl(module, loop, task);
exit:
return return_value;
}
-/*[clinic end generated code: output=fd474bdc8f03d5ae input=a9049054013a1b77]*/
+/*[clinic end generated code: output=e3b02d96da56e80c input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_bz2module.c.h b/Modules/clinic/_bz2module.c.h
index fb64333..cc16d8b 100644
--- a/Modules/clinic/_bz2module.c.h
+++ b/Modules/clinic/_bz2module.c.h
@@ -142,14 +142,44 @@ _bz2_BZ2Decompressor_decompress(BZ2Decompressor *self, PyObject *const *args, Py
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"data", "max_length", NULL};
- static _PyArg_Parser _parser = {"y*|n:decompress", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "decompress", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
Py_buffer data = {NULL, NULL};
Py_ssize_t max_length = -1;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &data, &max_length)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
+ goto exit;
+ }
+ if (!PyBuffer_IsContiguous(&data, 'C')) {
+ _PyArg_BadArgument("decompress", 1, "contiguous buffer", args[0]);
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ {
+ Py_ssize_t ival = -1;
+ PyObject *iobj = PyNumber_Index(args[1]);
+ if (iobj != NULL) {
+ ival = PyLong_AsSsize_t(iobj);
+ Py_DECREF(iobj);
+ }
+ if (ival == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ max_length = ival;
+ }
+skip_optional_pos:
return_value = _bz2_BZ2Decompressor_decompress_impl(self, &data, max_length);
exit:
@@ -190,4 +220,4 @@ _bz2_BZ2Decompressor___init__(PyObject *self, PyObject *args, PyObject *kwargs)
exit:
return return_value;
}
-/*[clinic end generated code: output=892c6133e97ff840 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=8e123f4eec497655 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_codecsmodule.c.h b/Modules/clinic/_codecsmodule.c.h
index a8223ad..d1f4cf3 100644
--- a/Modules/clinic/_codecsmodule.c.h
+++ b/Modules/clinic/_codecsmodule.c.h
@@ -76,15 +76,53 @@ _codecs_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"obj", "encoding", "errors", NULL};
- static _PyArg_Parser _parser = {"O|ss:encode", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "encode", 0};
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *obj;
const char *encoding = NULL;
const char *errors = NULL;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &obj, &encoding, &errors)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ obj = args[0];
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[1]) {
+ if (!PyUnicode_Check(args[1])) {
+ _PyArg_BadArgument("encode", 2, "str", args[1]);
+ goto exit;
+ }
+ Py_ssize_t encoding_length;
+ encoding = PyUnicode_AsUTF8AndSize(args[1], &encoding_length);
+ if (encoding == NULL) {
+ goto exit;
+ }
+ if (strlen(encoding) != (size_t)encoding_length) {
+ PyErr_SetString(PyExc_ValueError, "embedded null character");
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ if (!PyUnicode_Check(args[2])) {
+ _PyArg_BadArgument("encode", 3, "str", args[2]);
+ goto exit;
+ }
+ Py_ssize_t errors_length;
+ errors = PyUnicode_AsUTF8AndSize(args[2], &errors_length);
+ if (errors == NULL) {
+ goto exit;
+ }
+ if (strlen(errors) != (size_t)errors_length) {
+ PyErr_SetString(PyExc_ValueError, "embedded null character");
+ goto exit;
+ }
+skip_optional_pos:
return_value = _codecs_encode_impl(module, obj, encoding, errors);
exit:
@@ -115,15 +153,53 @@ _codecs_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"obj", "encoding", "errors", NULL};
- static _PyArg_Parser _parser = {"O|ss:decode", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "decode", 0};
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *obj;
const char *encoding = NULL;
const char *errors = NULL;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &obj, &encoding, &errors)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ obj = args[0];
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[1]) {
+ if (!PyUnicode_Check(args[1])) {
+ _PyArg_BadArgument("decode", 2, "str", args[1]);
+ goto exit;
+ }
+ Py_ssize_t encoding_length;
+ encoding = PyUnicode_AsUTF8AndSize(args[1], &encoding_length);
+ if (encoding == NULL) {
+ goto exit;
+ }
+ if (strlen(encoding) != (size_t)encoding_length) {
+ PyErr_SetString(PyExc_ValueError, "embedded null character");
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ if (!PyUnicode_Check(args[2])) {
+ _PyArg_BadArgument("decode", 3, "str", args[2]);
+ goto exit;
+ }
+ Py_ssize_t errors_length;
+ errors = PyUnicode_AsUTF8AndSize(args[2], &errors_length);
+ if (errors == NULL) {
+ goto exit;
+ }
+ if (strlen(errors) != (size_t)errors_length) {
+ PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
+skip_optional_pos:
return_value = _codecs_decode_impl(module, obj, encoding, errors);
exit:
@@ -2948,4 +3024,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=85ea29db163ee74c input=a9049054013a1b77]*/
+/*[clinic end generated code: output=02bd0f0cf9a28150 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_cursesmodule.c.h b/Modules/clinic/_cursesmodule.c.h
index 659fd4e..6837eac 100644
--- a/Modules/clinic/_cursesmodule.c.h
+++ b/Modules/clinic/_cursesmodule.c.h
@@ -2988,14 +2988,52 @@ _curses_setupterm(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyO
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"term", "fd", NULL};
- static _PyArg_Parser _parser = {"|zi:setupterm", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "setupterm", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
const char *term = NULL;
int fd = -1;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &term, &fd)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 2, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[0]) {
+ if (args[0] == Py_None) {
+ term = NULL;
+ }
+ else if (PyUnicode_Check(args[0])) {
+ Py_ssize_t term_length;
+ term = PyUnicode_AsUTF8AndSize(args[0], &term_length);
+ if (term == NULL) {
+ goto exit;
+ }
+ if (strlen(term) != (size_t)term_length) {
+ PyErr_SetString(PyExc_ValueError, "embedded null character");
+ goto exit;
+ }
+ }
+ else {
+ _PyArg_BadArgument("setupterm", 1, "str or None", args[0]);
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ fd = _PyLong_AsInt(args[1]);
+ if (fd == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+skip_optional_pos:
return_value = _curses_setupterm_impl(module, term, fd);
exit:
@@ -4531,4 +4569,4 @@ _curses_use_default_colors(PyObject *module, PyObject *Py_UNUSED(ignored))
#ifndef _CURSES_USE_DEFAULT_COLORS_METHODDEF
#define _CURSES_USE_DEFAULT_COLORS_METHODDEF
#endif /* !defined(_CURSES_USE_DEFAULT_COLORS_METHODDEF) */
-/*[clinic end generated code: output=5305982cb312a911 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=1350eeb0c1e06af6 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_datetimemodule.c.h b/Modules/clinic/_datetimemodule.c.h
index 36b4fca..447036c 100644
--- a/Modules/clinic/_datetimemodule.c.h
+++ b/Modules/clinic/_datetimemodule.c.h
@@ -36,16 +36,23 @@ datetime_datetime_now(PyTypeObject *type, PyObject *const *args, Py_ssize_t narg
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"tz", NULL};
- static _PyArg_Parser _parser = {"|O:now", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "now", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *tz = Py_None;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &tz)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ tz = args[0];
+skip_optional_pos:
return_value = datetime_datetime_now_impl(type, tz);
exit:
return return_value;
}
-/*[clinic end generated code: output=b3d746843403a8ce input=a9049054013a1b77]*/
+/*[clinic end generated code: output=aae916ab728ca85b input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_elementtree.c.h b/Modules/clinic/_elementtree.c.h
index 1293acd..d239c80 100644
--- a/Modules/clinic/_elementtree.c.h
+++ b/Modules/clinic/_elementtree.c.h
@@ -169,14 +169,22 @@ _elementtree_Element_find(ElementObject *self, PyObject *const *args, Py_ssize_t
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", "namespaces", NULL};
- static _PyArg_Parser _parser = {"O|O:find", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "find", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *path;
PyObject *namespaces = Py_None;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &path, &namespaces)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ path = args[0];
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ namespaces = args[1];
+skip_optional_pos:
return_value = _elementtree_Element_find_impl(self, path, namespaces);
exit:
@@ -201,15 +209,29 @@ _elementtree_Element_findtext(ElementObject *self, PyObject *const *args, Py_ssi
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", "default", "namespaces", NULL};
- static _PyArg_Parser _parser = {"O|OO:findtext", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "findtext", 0};
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *path;
PyObject *default_value = Py_None;
PyObject *namespaces = Py_None;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &path, &default_value, &namespaces)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ path = args[0];
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[1]) {
+ default_value = args[1];
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ namespaces = args[2];
+skip_optional_pos:
return_value = _elementtree_Element_findtext_impl(self, path, default_value, namespaces);
exit:
@@ -233,14 +255,22 @@ _elementtree_Element_findall(ElementObject *self, PyObject *const *args, Py_ssiz
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", "namespaces", NULL};
- static _PyArg_Parser _parser = {"O|O:findall", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "findall", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *path;
PyObject *namespaces = Py_None;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &path, &namespaces)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ path = args[0];
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ namespaces = args[1];
+skip_optional_pos:
return_value = _elementtree_Element_findall_impl(self, path, namespaces);
exit:
@@ -264,14 +294,22 @@ _elementtree_Element_iterfind(ElementObject *self, PyObject *const *args, Py_ssi
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", "namespaces", NULL};
- static _PyArg_Parser _parser = {"O|O:iterfind", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "iterfind", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *path;
PyObject *namespaces = Py_None;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &path, &namespaces)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ path = args[0];
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ namespaces = args[1];
+skip_optional_pos:
return_value = _elementtree_Element_iterfind_impl(self, path, namespaces);
exit:
@@ -295,14 +333,22 @@ _elementtree_Element_get(ElementObject *self, PyObject *const *args, Py_ssize_t
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"key", "default", NULL};
- static _PyArg_Parser _parser = {"O|O:get", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "get", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *key;
PyObject *default_value = Py_None;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &key, &default_value)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ key = args[0];
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ default_value = args[1];
+skip_optional_pos:
return_value = _elementtree_Element_get_impl(self, key, default_value);
exit:
@@ -342,13 +388,20 @@ _elementtree_Element_iter(ElementObject *self, PyObject *const *args, Py_ssize_t
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"tag", NULL};
- static _PyArg_Parser _parser = {"|O:iter", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "iter", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *tag = Py_None;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &tag)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ tag = args[0];
+skip_optional_pos:
return_value = _elementtree_Element_iter_impl(self, tag);
exit:
@@ -371,13 +424,20 @@ _elementtree_Element_getiterator(ElementObject *self, PyObject *const *args, Py_
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"tag", NULL};
- static _PyArg_Parser _parser = {"|O:getiterator", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "getiterator", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *tag = Py_None;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &tag)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ tag = args[0];
+skip_optional_pos:
return_value = _elementtree_Element_getiterator_impl(self, tag);
exit:
@@ -582,13 +642,22 @@ _elementtree_TreeBuilder___init__(PyObject *self, PyObject *args, PyObject *kwar
{
int return_value = -1;
static const char * const _keywords[] = {"element_factory", NULL};
- static _PyArg_Parser _parser = {"|O:TreeBuilder", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "TreeBuilder", 0};
+ PyObject *argsbuf[1];
+ PyObject * const *fastargs;
+ Py_ssize_t nargs = PyTuple_GET_SIZE(args);
+ Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0;
PyObject *element_factory = NULL;
- if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
- &element_factory)) {
+ fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 1, 0, argsbuf);
+ if (!fastargs) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ element_factory = fastargs[0];
+skip_optional_pos:
return_value = _elementtree_TreeBuilder___init___impl((TreeBuilderObject *)self, element_factory);
exit:
@@ -671,14 +740,46 @@ _elementtree_XMLParser___init__(PyObject *self, PyObject *args, PyObject *kwargs
{
int return_value = -1;
static const char * const _keywords[] = {"target", "encoding", NULL};
- static _PyArg_Parser _parser = {"|$Oz:XMLParser", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "XMLParser", 0};
+ PyObject *argsbuf[2];
+ PyObject * const *fastargs;
+ Py_ssize_t nargs = PyTuple_GET_SIZE(args);
+ Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0;
PyObject *target = NULL;
const char *encoding = NULL;
- if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
- &target, &encoding)) {
+ fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 0, 0, argsbuf);
+ if (!fastargs) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (fastargs[0]) {
+ target = fastargs[0];
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ if (fastargs[1] == Py_None) {
+ encoding = NULL;
+ }
+ else if (PyUnicode_Check(fastargs[1])) {
+ Py_ssize_t encoding_length;
+ encoding = PyUnicode_AsUTF8AndSize(fastargs[1], &encoding_length);
+ if (encoding == NULL) {
+ goto exit;
+ }
+ if (strlen(encoding) != (size_t)encoding_length) {
+ PyErr_SetString(PyExc_ValueError, "embedded null character");
+ goto exit;
+ }
+ }
+ else {
+ _PyArg_BadArgument("XMLParser", 2, "str or None", fastargs[1]);
goto exit;
}
+skip_optional_kwonly:
return_value = _elementtree_XMLParser___init___impl((XMLParserObject *)self, target, encoding);
exit:
@@ -752,4 +853,4 @@ skip_optional:
exit:
return return_value;
}
-/*[clinic end generated code: output=0c15c41e03a7829f input=a9049054013a1b77]*/
+/*[clinic end generated code: output=440b5d90a4b86590 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_hashopenssl.c.h b/Modules/clinic/_hashopenssl.c.h
index 43f9651..5596f13 100644
--- a/Modules/clinic/_hashopenssl.c.h
+++ b/Modules/clinic/_hashopenssl.c.h
@@ -87,14 +87,22 @@ EVP_new(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwn
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"name", "string", NULL};
- static _PyArg_Parser _parser = {"O|O:new", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "new", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *name_obj;
PyObject *data_obj = NULL;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &name_obj, &data_obj)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ name_obj = args[0];
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ data_obj = args[1];
+skip_optional_pos:
return_value = EVP_new_impl(module, name_obj, data_obj);
exit:
@@ -123,17 +131,60 @@ pbkdf2_hmac(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"hash_name", "password", "salt", "iterations", "dklen", NULL};
- static _PyArg_Parser _parser = {"sy*y*l|O:pbkdf2_hmac", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "pbkdf2_hmac", 0};
+ PyObject *argsbuf[5];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 4;
const char *hash_name;
Py_buffer password = {NULL, NULL};
Py_buffer salt = {NULL, NULL};
long iterations;
PyObject *dklen_obj = Py_None;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &hash_name, &password, &salt, &iterations, &dklen_obj)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 4, 5, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!PyUnicode_Check(args[0])) {
+ _PyArg_BadArgument("pbkdf2_hmac", 1, "str", args[0]);
+ goto exit;
+ }
+ Py_ssize_t hash_name_length;
+ hash_name = PyUnicode_AsUTF8AndSize(args[0], &hash_name_length);
+ if (hash_name == NULL) {
+ goto exit;
+ }
+ if (strlen(hash_name) != (size_t)hash_name_length) {
+ PyErr_SetString(PyExc_ValueError, "embedded null character");
+ goto exit;
+ }
+ if (PyObject_GetBuffer(args[1], &password, PyBUF_SIMPLE) != 0) {
+ goto exit;
+ }
+ if (!PyBuffer_IsContiguous(&password, 'C')) {
+ _PyArg_BadArgument("pbkdf2_hmac", 2, "contiguous buffer", args[1]);
+ goto exit;
+ }
+ if (PyObject_GetBuffer(args[2], &salt, PyBUF_SIMPLE) != 0) {
+ goto exit;
+ }
+ if (!PyBuffer_IsContiguous(&salt, 'C')) {
+ _PyArg_BadArgument("pbkdf2_hmac", 3, "contiguous buffer", args[2]);
+ goto exit;
+ }
+ if (PyFloat_Check(args[3])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ iterations = PyLong_AsLong(args[3]);
+ if (iterations == -1 && PyErr_Occurred()) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ dklen_obj = args[4];
+skip_optional_pos:
return_value = pbkdf2_hmac_impl(module, hash_name, &password, &salt, iterations, dklen_obj);
exit:
@@ -173,7 +224,9 @@ _hashlib_scrypt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"password", "salt", "n", "r", "p", "maxmem", "dklen", NULL};
- static _PyArg_Parser _parser = {"y*|$y*O!O!O!ll:scrypt", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "scrypt", 0};
+ PyObject *argsbuf[7];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
Py_buffer password = {NULL, NULL};
Py_buffer salt = {NULL, NULL};
PyObject *n_obj = Py_None;
@@ -182,10 +235,86 @@ _hashlib_scrypt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
long maxmem = 0;
long dklen = 64;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &password, &salt, &PyLong_Type, &n_obj, &PyLong_Type, &r_obj, &PyLong_Type, &p_obj, &maxmem, &dklen)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (PyObject_GetBuffer(args[0], &password, PyBUF_SIMPLE) != 0) {
+ goto exit;
+ }
+ if (!PyBuffer_IsContiguous(&password, 'C')) {
+ _PyArg_BadArgument("scrypt", 1, "contiguous buffer", args[0]);
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (args[1]) {
+ if (PyObject_GetBuffer(args[1], &salt, PyBUF_SIMPLE) != 0) {
+ goto exit;
+ }
+ if (!PyBuffer_IsContiguous(&salt, 'C')) {
+ _PyArg_BadArgument("scrypt", 2, "contiguous buffer", args[1]);
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ if (args[2]) {
+ if (!PyLong_Check(args[2])) {
+ _PyArg_BadArgument("scrypt", 3, "int", args[2]);
+ goto exit;
+ }
+ n_obj = args[2];
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ if (args[3]) {
+ if (!PyLong_Check(args[3])) {
+ _PyArg_BadArgument("scrypt", 4, "int", args[3]);
+ goto exit;
+ }
+ r_obj = args[3];
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ if (args[4]) {
+ if (!PyLong_Check(args[4])) {
+ _PyArg_BadArgument("scrypt", 5, "int", args[4]);
+ goto exit;
+ }
+ p_obj = args[4];
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ if (args[5]) {
+ if (PyFloat_Check(args[5])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ maxmem = PyLong_AsLong(args[5]);
+ if (maxmem == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ if (PyFloat_Check(args[6])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ dklen = PyLong_AsLong(args[6]);
+ if (dklen == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+skip_optional_kwonly:
return_value = _hashlib_scrypt_impl(module, &password, &salt, n_obj, r_obj, p_obj, maxmem, dklen);
exit:
@@ -221,13 +350,41 @@ _hashlib_hmac_digest(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"key", "msg", "digest", NULL};
- static _PyArg_Parser _parser = {"y*y*s:hmac_digest", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "hmac_digest", 0};
+ PyObject *argsbuf[3];
Py_buffer key = {NULL, NULL};
Py_buffer msg = {NULL, NULL};
const char *digest;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &key, &msg, &digest)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 3, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (PyObject_GetBuffer(args[0], &key, PyBUF_SIMPLE) != 0) {
+ goto exit;
+ }
+ if (!PyBuffer_IsContiguous(&key, 'C')) {
+ _PyArg_BadArgument("hmac_digest", 1, "contiguous buffer", args[0]);
+ goto exit;
+ }
+ if (PyObject_GetBuffer(args[1], &msg, PyBUF_SIMPLE) != 0) {
+ goto exit;
+ }
+ if (!PyBuffer_IsContiguous(&msg, 'C')) {
+ _PyArg_BadArgument("hmac_digest", 2, "contiguous buffer", args[1]);
+ goto exit;
+ }
+ if (!PyUnicode_Check(args[2])) {
+ _PyArg_BadArgument("hmac_digest", 3, "str", args[2]);
+ goto exit;
+ }
+ Py_ssize_t digest_length;
+ digest = PyUnicode_AsUTF8AndSize(args[2], &digest_length);
+ if (digest == NULL) {
+ goto exit;
+ }
+ if (strlen(digest) != (size_t)digest_length) {
+ PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _hashlib_hmac_digest_impl(module, &key, &msg, digest);
@@ -252,4 +409,4 @@ exit:
#ifndef _HASHLIB_SCRYPT_METHODDEF
#define _HASHLIB_SCRYPT_METHODDEF
#endif /* !defined(_HASHLIB_SCRYPT_METHODDEF) */
-/*[clinic end generated code: output=fe5931d2b301ca12 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=5955ec791260045a input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_lzmamodule.c.h b/Modules/clinic/_lzmamodule.c.h
index aeb98a6..68aa770 100644
--- a/Modules/clinic/_lzmamodule.c.h
+++ b/Modules/clinic/_lzmamodule.c.h
@@ -96,14 +96,44 @@ _lzma_LZMADecompressor_decompress(Decompressor *self, PyObject *const *args, Py_
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"data", "max_length", NULL};
- static _PyArg_Parser _parser = {"y*|n:decompress", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "decompress", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
Py_buffer data = {NULL, NULL};
Py_ssize_t max_length = -1;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &data, &max_length)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
+ goto exit;
+ }
+ if (!PyBuffer_IsContiguous(&data, 'C')) {
+ _PyArg_BadArgument("decompress", 1, "contiguous buffer", args[0]);
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ {
+ Py_ssize_t ival = -1;
+ PyObject *iobj = PyNumber_Index(args[1]);
+ if (iobj != NULL) {
+ ival = PyLong_AsSsize_t(iobj);
+ Py_DECREF(iobj);
+ }
+ if (ival == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ max_length = ival;
+ }
+skip_optional_pos:
return_value = _lzma_LZMADecompressor_decompress_impl(self, &data, max_length);
exit:
@@ -147,15 +177,44 @@ _lzma_LZMADecompressor___init__(PyObject *self, PyObject *args, PyObject *kwargs
{
int return_value = -1;
static const char * const _keywords[] = {"format", "memlimit", "filters", NULL};
- static _PyArg_Parser _parser = {"|iOO:LZMADecompressor", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "LZMADecompressor", 0};
+ PyObject *argsbuf[3];
+ PyObject * const *fastargs;
+ Py_ssize_t nargs = PyTuple_GET_SIZE(args);
+ Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0;
int format = FORMAT_AUTO;
PyObject *memlimit = Py_None;
PyObject *filters = Py_None;
- if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
- &format, &memlimit, &filters)) {
+ fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 3, 0, argsbuf);
+ if (!fastargs) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (fastargs[0]) {
+ if (PyFloat_Check(fastargs[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ format = _PyLong_AsInt(fastargs[0]);
+ if (format == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ if (fastargs[1]) {
+ memlimit = fastargs[1];
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ filters = fastargs[2];
+skip_optional_pos:
return_value = _lzma_LZMADecompressor___init___impl((Decompressor *)self, format, memlimit, filters);
exit:
@@ -275,4 +334,4 @@ exit:
return return_value;
}
-/*[clinic end generated code: output=47e4732df79509ad input=a9049054013a1b77]*/
+/*[clinic end generated code: output=1a290aa478603107 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_opcode.c.h b/Modules/clinic/_opcode.c.h
index 2104a52..777701f 100644
--- a/Modules/clinic/_opcode.c.h
+++ b/Modules/clinic/_opcode.c.h
@@ -20,16 +20,38 @@ _opcode_stack_effect(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"", "", "jump", NULL};
- static _PyArg_Parser _parser = {"i|O$O:stack_effect", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "stack_effect", 0};
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
int opcode;
PyObject *oparg = Py_None;
PyObject *jump = Py_None;
int _return_value;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &opcode, &oparg, &jump)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ opcode = _PyLong_AsInt(args[0]);
+ if (opcode == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (nargs < 2) {
+ goto skip_optional_posonly;
+ }
+ noptargs--;
+ oparg = args[1];
+skip_optional_posonly:
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ jump = args[2];
+skip_optional_kwonly:
_return_value = _opcode_stack_effect_impl(module, opcode, oparg, jump);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
@@ -39,4 +61,4 @@ _opcode_stack_effect(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
exit:
return return_value;
}
-/*[clinic end generated code: output=871941eea3d855c6 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=7bc08f2835b2cf89 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_pickle.c.h b/Modules/clinic/_pickle.c.h
index 2759b2f2..1da2f93 100644
--- a/Modules/clinic/_pickle.c.h
+++ b/Modules/clinic/_pickle.c.h
@@ -94,15 +94,34 @@ _pickle_Pickler___init__(PyObject *self, PyObject *args, PyObject *kwargs)
{
int return_value = -1;
static const char * const _keywords[] = {"file", "protocol", "fix_imports", NULL};
- static _PyArg_Parser _parser = {"O|Op:Pickler", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "Pickler", 0};
+ PyObject *argsbuf[3];
+ PyObject * const *fastargs;
+ Py_ssize_t nargs = PyTuple_GET_SIZE(args);
+ Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 1;
PyObject *file;
PyObject *protocol = NULL;
int fix_imports = 1;
- if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
- &file, &protocol, &fix_imports)) {
+ fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 3, 0, argsbuf);
+ if (!fastargs) {
goto exit;
}
+ file = fastargs[0];
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (fastargs[1]) {
+ protocol = fastargs[1];
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ fix_imports = PyObject_IsTrue(fastargs[2]);
+ if (fix_imports < 0) {
+ goto exit;
+ }
+skip_optional_pos:
return_value = _pickle_Pickler___init___impl((PicklerObject *)self, file, protocol, fix_imports);
exit:
@@ -287,16 +306,65 @@ _pickle_Unpickler___init__(PyObject *self, PyObject *args, PyObject *kwargs)
{
int return_value = -1;
static const char * const _keywords[] = {"file", "fix_imports", "encoding", "errors", NULL};
- static _PyArg_Parser _parser = {"O|$pss:Unpickler", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "Unpickler", 0};
+ PyObject *argsbuf[4];
+ PyObject * const *fastargs;
+ Py_ssize_t nargs = PyTuple_GET_SIZE(args);
+ Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 1;
PyObject *file;
int fix_imports = 1;
const char *encoding = "ASCII";
const char *errors = "strict";
- if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
- &file, &fix_imports, &encoding, &errors)) {
+ fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 1, 0, argsbuf);
+ if (!fastargs) {
+ goto exit;
+ }
+ file = fastargs[0];
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (fastargs[1]) {
+ fix_imports = PyObject_IsTrue(fastargs[1]);
+ if (fix_imports < 0) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ if (fastargs[2]) {
+ if (!PyUnicode_Check(fastargs[2])) {
+ _PyArg_BadArgument("Unpickler", 3, "str", fastargs[2]);
+ goto exit;
+ }
+ Py_ssize_t encoding_length;
+ encoding = PyUnicode_AsUTF8AndSize(fastargs[2], &encoding_length);
+ if (encoding == NULL) {
+ goto exit;
+ }
+ if (strlen(encoding) != (size_t)encoding_length) {
+ PyErr_SetString(PyExc_ValueError, "embedded null character");
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ if (!PyUnicode_Check(fastargs[3])) {
+ _PyArg_BadArgument("Unpickler", 4, "str", fastargs[3]);
+ goto exit;
+ }
+ Py_ssize_t errors_length;
+ errors = PyUnicode_AsUTF8AndSize(fastargs[3], &errors_length);
+ if (errors == NULL) {
goto exit;
}
+ if (strlen(errors) != (size_t)errors_length) {
+ PyErr_SetString(PyExc_ValueError, "embedded null character");
+ goto exit;
+ }
+skip_optional_kwonly:
return_value = _pickle_Unpickler___init___impl((UnpicklerObject *)self, file, fix_imports, encoding, errors);
exit:
@@ -396,16 +464,38 @@ _pickle_dump(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"obj", "file", "protocol", "fix_imports", NULL};
- static _PyArg_Parser _parser = {"OO|O$p:dump", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "dump", 0};
+ PyObject *argsbuf[4];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
PyObject *obj;
PyObject *file;
PyObject *protocol = NULL;
int fix_imports = 1;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &obj, &file, &protocol, &fix_imports)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ obj = args[0];
+ file = args[1];
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[2]) {
+ protocol = args[2];
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+skip_optional_pos:
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ fix_imports = PyObject_IsTrue(args[3]);
+ if (fix_imports < 0) {
goto exit;
}
+skip_optional_kwonly:
return_value = _pickle_dump_impl(module, obj, file, protocol, fix_imports);
exit:
@@ -443,15 +533,36 @@ _pickle_dumps(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"obj", "protocol", "fix_imports", NULL};
- static _PyArg_Parser _parser = {"O|O$p:dumps", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "dumps", 0};
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *obj;
PyObject *protocol = NULL;
int fix_imports = 1;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &obj, &protocol, &fix_imports)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ obj = args[0];
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[1]) {
+ protocol = args[1];
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+skip_optional_pos:
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ fix_imports = PyObject_IsTrue(args[2]);
+ if (fix_imports < 0) {
+ goto exit;
+ }
+skip_optional_kwonly:
return_value = _pickle_dumps_impl(module, obj, protocol, fix_imports);
exit:
@@ -499,16 +610,63 @@ _pickle_load(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"file", "fix_imports", "encoding", "errors", NULL};
- static _PyArg_Parser _parser = {"O|$pss:load", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "load", 0};
+ PyObject *argsbuf[4];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *file;
int fix_imports = 1;
const char *encoding = "ASCII";
const char *errors = "strict";
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &file, &fix_imports, &encoding, &errors)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ file = args[0];
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (args[1]) {
+ fix_imports = PyObject_IsTrue(args[1]);
+ if (fix_imports < 0) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ if (args[2]) {
+ if (!PyUnicode_Check(args[2])) {
+ _PyArg_BadArgument("load", 3, "str", args[2]);
+ goto exit;
+ }
+ Py_ssize_t encoding_length;
+ encoding = PyUnicode_AsUTF8AndSize(args[2], &encoding_length);
+ if (encoding == NULL) {
+ goto exit;
+ }
+ if (strlen(encoding) != (size_t)encoding_length) {
+ PyErr_SetString(PyExc_ValueError, "embedded null character");
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ if (!PyUnicode_Check(args[3])) {
+ _PyArg_BadArgument("load", 4, "str", args[3]);
+ goto exit;
+ }
+ Py_ssize_t errors_length;
+ errors = PyUnicode_AsUTF8AndSize(args[3], &errors_length);
+ if (errors == NULL) {
+ goto exit;
+ }
+ if (strlen(errors) != (size_t)errors_length) {
+ PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
+skip_optional_kwonly:
return_value = _pickle_load_impl(module, file, fix_imports, encoding, errors);
exit:
@@ -547,19 +705,66 @@ _pickle_loads(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"data", "fix_imports", "encoding", "errors", NULL};
- static _PyArg_Parser _parser = {"O|$pss:loads", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "loads", 0};
+ PyObject *argsbuf[4];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *data;
int fix_imports = 1;
const char *encoding = "ASCII";
const char *errors = "strict";
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &data, &fix_imports, &encoding, &errors)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ data = args[0];
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (args[1]) {
+ fix_imports = PyObject_IsTrue(args[1]);
+ if (fix_imports < 0) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ if (args[2]) {
+ if (!PyUnicode_Check(args[2])) {
+ _PyArg_BadArgument("loads", 3, "str", args[2]);
+ goto exit;
+ }
+ Py_ssize_t encoding_length;
+ encoding = PyUnicode_AsUTF8AndSize(args[2], &encoding_length);
+ if (encoding == NULL) {
+ goto exit;
+ }
+ if (strlen(encoding) != (size_t)encoding_length) {
+ PyErr_SetString(PyExc_ValueError, "embedded null character");
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ if (!PyUnicode_Check(args[3])) {
+ _PyArg_BadArgument("loads", 4, "str", args[3]);
+ goto exit;
+ }
+ Py_ssize_t errors_length;
+ errors = PyUnicode_AsUTF8AndSize(args[3], &errors_length);
+ if (errors == NULL) {
+ goto exit;
+ }
+ if (strlen(errors) != (size_t)errors_length) {
+ PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
+skip_optional_kwonly:
return_value = _pickle_loads_impl(module, data, fix_imports, encoding, errors);
exit:
return return_value;
}
-/*[clinic end generated code: output=225f06abcf27ed2b input=a9049054013a1b77]*/
+/*[clinic end generated code: output=8f972562c8f71e2b input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_queuemodule.c.h b/Modules/clinic/_queuemodule.c.h
index a19fe78..c25eacf 100644
--- a/Modules/clinic/_queuemodule.c.h
+++ b/Modules/clinic/_queuemodule.c.h
@@ -51,15 +51,32 @@ _queue_SimpleQueue_put(simplequeueobject *self, PyObject *const *args, Py_ssize_
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"item", "block", "timeout", NULL};
- static _PyArg_Parser _parser = {"O|pO:put", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "put", 0};
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *item;
int block = 1;
PyObject *timeout = Py_None;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &item, &block, &timeout)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ item = args[0];
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[1]) {
+ block = PyObject_IsTrue(args[1]);
+ if (block < 0) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ timeout = args[2];
+skip_optional_pos:
return_value = _queue_SimpleQueue_put_impl(self, item, block, timeout);
exit:
@@ -86,13 +103,15 @@ _queue_SimpleQueue_put_nowait(simplequeueobject *self, PyObject *const *args, Py
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"item", NULL};
- static _PyArg_Parser _parser = {"O:put_nowait", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "put_nowait", 0};
+ PyObject *argsbuf[1];
PyObject *item;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &item)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ item = args[0];
return_value = _queue_SimpleQueue_put_nowait_impl(self, item);
exit:
@@ -125,14 +144,30 @@ _queue_SimpleQueue_get(simplequeueobject *self, PyObject *const *args, Py_ssize_
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"block", "timeout", NULL};
- static _PyArg_Parser _parser = {"|pO:get", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "get", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
int block = 1;
PyObject *timeout = Py_None;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &block, &timeout)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 2, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[0]) {
+ block = PyObject_IsTrue(args[0]);
+ if (block < 0) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ timeout = args[1];
+skip_optional_pos:
return_value = _queue_SimpleQueue_get_impl(self, block, timeout);
exit:
@@ -215,4 +250,4 @@ _queue_SimpleQueue_qsize(simplequeueobject *self, PyObject *Py_UNUSED(ignored))
exit:
return return_value;
}
-/*[clinic end generated code: output=c12ce9050f153304 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=b4717e2974cbc909 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_sre.c.h b/Modules/clinic/_sre.c.h
index e5bb32f..9c08dec 100644
--- a/Modules/clinic/_sre.c.h
+++ b/Modules/clinic/_sre.c.h
@@ -195,15 +195,61 @@ _sre_SRE_Pattern_match(PatternObject *self, PyObject *const *args, Py_ssize_t na
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
- static _PyArg_Parser _parser = {"O|nn:match", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "match", 0};
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *string;
Py_ssize_t pos = 0;
Py_ssize_t endpos = PY_SSIZE_T_MAX;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &string, &pos, &endpos)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ string = args[0];
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[1]) {
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ {
+ Py_ssize_t ival = -1;
+ PyObject *iobj = PyNumber_Index(args[1]);
+ if (iobj != NULL) {
+ ival = PyLong_AsSsize_t(iobj);
+ Py_DECREF(iobj);
+ }
+ if (ival == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ pos = ival;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ if (PyFloat_Check(args[2])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ {
+ Py_ssize_t ival = -1;
+ PyObject *iobj = PyNumber_Index(args[2]);
+ if (iobj != NULL) {
+ ival = PyLong_AsSsize_t(iobj);
+ Py_DECREF(iobj);
+ }
+ if (ival == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ endpos = ival;
+ }
+skip_optional_pos:
return_value = _sre_SRE_Pattern_match_impl(self, string, pos, endpos);
exit:
@@ -228,15 +274,61 @@ _sre_SRE_Pattern_fullmatch(PatternObject *self, PyObject *const *args, Py_ssize_
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
- static _PyArg_Parser _parser = {"O|nn:fullmatch", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "fullmatch", 0};
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *string;
Py_ssize_t pos = 0;
Py_ssize_t endpos = PY_SSIZE_T_MAX;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &string, &pos, &endpos)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ string = args[0];
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[1]) {
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ {
+ Py_ssize_t ival = -1;
+ PyObject *iobj = PyNumber_Index(args[1]);
+ if (iobj != NULL) {
+ ival = PyLong_AsSsize_t(iobj);
+ Py_DECREF(iobj);
+ }
+ if (ival == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ pos = ival;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ if (PyFloat_Check(args[2])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
goto exit;
}
+ {
+ Py_ssize_t ival = -1;
+ PyObject *iobj = PyNumber_Index(args[2]);
+ if (iobj != NULL) {
+ ival = PyLong_AsSsize_t(iobj);
+ Py_DECREF(iobj);
+ }
+ if (ival == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ endpos = ival;
+ }
+skip_optional_pos:
return_value = _sre_SRE_Pattern_fullmatch_impl(self, string, pos, endpos);
exit:
@@ -263,15 +355,61 @@ _sre_SRE_Pattern_search(PatternObject *self, PyObject *const *args, Py_ssize_t n
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
- static _PyArg_Parser _parser = {"O|nn:search", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "search", 0};
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *string;
Py_ssize_t pos = 0;
Py_ssize_t endpos = PY_SSIZE_T_MAX;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &string, &pos, &endpos)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ string = args[0];
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[1]) {
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ {
+ Py_ssize_t ival = -1;
+ PyObject *iobj = PyNumber_Index(args[1]);
+ if (iobj != NULL) {
+ ival = PyLong_AsSsize_t(iobj);
+ Py_DECREF(iobj);
+ }
+ if (ival == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ pos = ival;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ if (PyFloat_Check(args[2])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
goto exit;
}
+ {
+ Py_ssize_t ival = -1;
+ PyObject *iobj = PyNumber_Index(args[2]);
+ if (iobj != NULL) {
+ ival = PyLong_AsSsize_t(iobj);
+ Py_DECREF(iobj);
+ }
+ if (ival == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ endpos = ival;
+ }
+skip_optional_pos:
return_value = _sre_SRE_Pattern_search_impl(self, string, pos, endpos);
exit:
@@ -296,15 +434,61 @@ _sre_SRE_Pattern_findall(PatternObject *self, PyObject *const *args, Py_ssize_t
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
- static _PyArg_Parser _parser = {"O|nn:findall", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "findall", 0};
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *string;
Py_ssize_t pos = 0;
Py_ssize_t endpos = PY_SSIZE_T_MAX;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &string, &pos, &endpos)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ string = args[0];
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[1]) {
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ {
+ Py_ssize_t ival = -1;
+ PyObject *iobj = PyNumber_Index(args[1]);
+ if (iobj != NULL) {
+ ival = PyLong_AsSsize_t(iobj);
+ Py_DECREF(iobj);
+ }
+ if (ival == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ pos = ival;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ if (PyFloat_Check(args[2])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
goto exit;
}
+ {
+ Py_ssize_t ival = -1;
+ PyObject *iobj = PyNumber_Index(args[2]);
+ if (iobj != NULL) {
+ ival = PyLong_AsSsize_t(iobj);
+ Py_DECREF(iobj);
+ }
+ if (ival == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ endpos = ival;
+ }
+skip_optional_pos:
return_value = _sre_SRE_Pattern_findall_impl(self, string, pos, endpos);
exit:
@@ -331,15 +515,61 @@ _sre_SRE_Pattern_finditer(PatternObject *self, PyObject *const *args, Py_ssize_t
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
- static _PyArg_Parser _parser = {"O|nn:finditer", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "finditer", 0};
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *string;
Py_ssize_t pos = 0;
Py_ssize_t endpos = PY_SSIZE_T_MAX;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &string, &pos, &endpos)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ string = args[0];
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[1]) {
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ {
+ Py_ssize_t ival = -1;
+ PyObject *iobj = PyNumber_Index(args[1]);
+ if (iobj != NULL) {
+ ival = PyLong_AsSsize_t(iobj);
+ Py_DECREF(iobj);
+ }
+ if (ival == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ pos = ival;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ if (PyFloat_Check(args[2])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
goto exit;
}
+ {
+ Py_ssize_t ival = -1;
+ PyObject *iobj = PyNumber_Index(args[2]);
+ if (iobj != NULL) {
+ ival = PyLong_AsSsize_t(iobj);
+ Py_DECREF(iobj);
+ }
+ if (ival == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ endpos = ival;
+ }
+skip_optional_pos:
return_value = _sre_SRE_Pattern_finditer_impl(self, string, pos, endpos);
exit:
@@ -363,15 +593,61 @@ _sre_SRE_Pattern_scanner(PatternObject *self, PyObject *const *args, Py_ssize_t
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
- static _PyArg_Parser _parser = {"O|nn:scanner", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "scanner", 0};
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *string;
Py_ssize_t pos = 0;
Py_ssize_t endpos = PY_SSIZE_T_MAX;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &string, &pos, &endpos)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ string = args[0];
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[1]) {
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ {
+ Py_ssize_t ival = -1;
+ PyObject *iobj = PyNumber_Index(args[1]);
+ if (iobj != NULL) {
+ ival = PyLong_AsSsize_t(iobj);
+ Py_DECREF(iobj);
+ }
+ if (ival == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ pos = ival;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ if (PyFloat_Check(args[2])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ {
+ Py_ssize_t ival = -1;
+ PyObject *iobj = PyNumber_Index(args[2]);
+ if (iobj != NULL) {
+ ival = PyLong_AsSsize_t(iobj);
+ Py_DECREF(iobj);
+ }
+ if (ival == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ endpos = ival;
+ }
+skip_optional_pos:
return_value = _sre_SRE_Pattern_scanner_impl(self, string, pos, endpos);
exit:
@@ -396,14 +672,38 @@ _sre_SRE_Pattern_split(PatternObject *self, PyObject *const *args, Py_ssize_t na
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", "maxsplit", NULL};
- static _PyArg_Parser _parser = {"O|n:split", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "split", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *string;
Py_ssize_t maxsplit = 0;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &string, &maxsplit)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ string = args[0];
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
goto exit;
}
+ {
+ Py_ssize_t ival = -1;
+ PyObject *iobj = PyNumber_Index(args[1]);
+ if (iobj != NULL) {
+ ival = PyLong_AsSsize_t(iobj);
+ Py_DECREF(iobj);
+ }
+ if (ival == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ maxsplit = ival;
+ }
+skip_optional_pos:
return_value = _sre_SRE_Pattern_split_impl(self, string, maxsplit);
exit:
@@ -428,15 +728,40 @@ _sre_SRE_Pattern_sub(PatternObject *self, PyObject *const *args, Py_ssize_t narg
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"repl", "string", "count", NULL};
- static _PyArg_Parser _parser = {"OO|n:sub", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "sub", 0};
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
PyObject *repl;
PyObject *string;
Py_ssize_t count = 0;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &repl, &string, &count)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ repl = args[0];
+ string = args[1];
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (PyFloat_Check(args[2])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
goto exit;
}
+ {
+ Py_ssize_t ival = -1;
+ PyObject *iobj = PyNumber_Index(args[2]);
+ if (iobj != NULL) {
+ ival = PyLong_AsSsize_t(iobj);
+ Py_DECREF(iobj);
+ }
+ if (ival == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ count = ival;
+ }
+skip_optional_pos:
return_value = _sre_SRE_Pattern_sub_impl(self, repl, string, count);
exit:
@@ -461,15 +786,40 @@ _sre_SRE_Pattern_subn(PatternObject *self, PyObject *const *args, Py_ssize_t nar
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"repl", "string", "count", NULL};
- static _PyArg_Parser _parser = {"OO|n:subn", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "subn", 0};
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
PyObject *repl;
PyObject *string;
Py_ssize_t count = 0;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &repl, &string, &count)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ repl = args[0];
+ string = args[1];
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (PyFloat_Check(args[2])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
goto exit;
}
+ {
+ Py_ssize_t ival = -1;
+ PyObject *iobj = PyNumber_Index(args[2]);
+ if (iobj != NULL) {
+ ival = PyLong_AsSsize_t(iobj);
+ Py_DECREF(iobj);
+ }
+ if (ival == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ count = ival;
+ }
+skip_optional_pos:
return_value = _sre_SRE_Pattern_subn_impl(self, repl, string, count);
exit:
@@ -520,7 +870,8 @@ _sre_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"pattern", "flags", "code", "groups", "groupindex", "indexgroup", NULL};
- static _PyArg_Parser _parser = {"OiO!nO!O!:compile", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "compile", 0};
+ PyObject *argsbuf[6];
PyObject *pattern;
int flags;
PyObject *code;
@@ -528,10 +879,52 @@ _sre_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
PyObject *groupindex;
PyObject *indexgroup;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &pattern, &flags, &PyList_Type, &code, &groups, &PyDict_Type, &groupindex, &PyTuple_Type, &indexgroup)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 6, 6, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ pattern = args[0];
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ flags = _PyLong_AsInt(args[1]);
+ if (flags == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!PyList_Check(args[2])) {
+ _PyArg_BadArgument("compile", 3, "list", args[2]);
+ goto exit;
+ }
+ code = args[2];
+ if (PyFloat_Check(args[3])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ {
+ Py_ssize_t ival = -1;
+ PyObject *iobj = PyNumber_Index(args[3]);
+ if (iobj != NULL) {
+ ival = PyLong_AsSsize_t(iobj);
+ Py_DECREF(iobj);
+ }
+ if (ival == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ groups = ival;
+ }
+ if (!PyDict_Check(args[4])) {
+ _PyArg_BadArgument("compile", 5, "dict", args[4]);
+ goto exit;
+ }
+ groupindex = args[4];
+ if (!PyTuple_Check(args[5])) {
+ _PyArg_BadArgument("compile", 6, "tuple", args[5]);
+ goto exit;
+ }
+ indexgroup = args[5];
return_value = _sre_compile_impl(module, pattern, flags, code, groups, groupindex, indexgroup);
exit:
@@ -555,13 +948,15 @@ _sre_SRE_Match_expand(MatchObject *self, PyObject *const *args, Py_ssize_t nargs
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"template", NULL};
- static _PyArg_Parser _parser = {"O:expand", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "expand", 0};
+ PyObject *argsbuf[1];
PyObject *template;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &template)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ template = args[0];
return_value = _sre_SRE_Match_expand_impl(self, template);
exit:
@@ -588,13 +983,20 @@ _sre_SRE_Match_groups(MatchObject *self, PyObject *const *args, Py_ssize_t nargs
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"default", NULL};
- static _PyArg_Parser _parser = {"|O:groups", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "groups", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *default_value = Py_None;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &default_value)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ default_value = args[0];
+skip_optional_pos:
return_value = _sre_SRE_Match_groups_impl(self, default_value);
exit:
@@ -621,13 +1023,20 @@ _sre_SRE_Match_groupdict(MatchObject *self, PyObject *const *args, Py_ssize_t na
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"default", NULL};
- static _PyArg_Parser _parser = {"|O:groupdict", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "groupdict", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *default_value = Py_None;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &default_value)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ default_value = args[0];
+skip_optional_pos:
return_value = _sre_SRE_Match_groupdict_impl(self, default_value);
exit:
@@ -798,4 +1207,4 @@ _sre_SRE_Scanner_search(ScannerObject *self, PyObject *Py_UNUSED(ignored))
{
return _sre_SRE_Scanner_search_impl(self);
}
-/*[clinic end generated code: output=8d19359d6a4a3a7e input=a9049054013a1b77]*/
+/*[clinic end generated code: output=67b702da5bdc9cac input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_ssl.c.h b/Modules/clinic/_ssl.c.h
index 3ec30c3..b1012f7 100644
--- a/Modules/clinic/_ssl.c.h
+++ b/Modules/clinic/_ssl.c.h
@@ -340,13 +340,32 @@ _ssl__SSLSocket_get_channel_binding(PySSLSocket *self, PyObject *const *args, Py
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"cb_type", NULL};
- static _PyArg_Parser _parser = {"|s:get_channel_binding", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "get_channel_binding", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
const char *cb_type = "tls-unique";
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &cb_type)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (!PyUnicode_Check(args[0])) {
+ _PyArg_BadArgument("get_channel_binding", 1, "str", args[0]);
+ goto exit;
+ }
+ Py_ssize_t cb_type_length;
+ cb_type = PyUnicode_AsUTF8AndSize(args[0], &cb_type_length);
+ if (cb_type == NULL) {
+ goto exit;
+ }
+ if (strlen(cb_type) != (size_t)cb_type_length) {
+ PyErr_SetString(PyExc_ValueError, "embedded null character");
+ goto exit;
+ }
+skip_optional_pos:
return_value = _ssl__SSLSocket_get_channel_binding_impl(self, cb_type);
exit:
@@ -548,15 +567,29 @@ _ssl__SSLContext_load_cert_chain(PySSLContext *self, PyObject *const *args, Py_s
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"certfile", "keyfile", "password", NULL};
- static _PyArg_Parser _parser = {"O|OO:load_cert_chain", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "load_cert_chain", 0};
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *certfile;
PyObject *keyfile = NULL;
PyObject *password = NULL;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &certfile, &keyfile, &password)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ certfile = args[0];
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[1]) {
+ keyfile = args[1];
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ password = args[2];
+skip_optional_pos:
return_value = _ssl__SSLContext_load_cert_chain_impl(self, certfile, keyfile, password);
exit:
@@ -582,15 +615,34 @@ _ssl__SSLContext_load_verify_locations(PySSLContext *self, PyObject *const *args
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"cafile", "capath", "cadata", NULL};
- static _PyArg_Parser _parser = {"|OOO:load_verify_locations", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "load_verify_locations", 0};
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *cafile = NULL;
PyObject *capath = NULL;
PyObject *cadata = NULL;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &cafile, &capath, &cadata)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 3, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[0]) {
+ cafile = args[0];
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ if (args[1]) {
+ capath = args[1];
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ cadata = args[2];
+skip_optional_pos:
return_value = _ssl__SSLContext_load_verify_locations_impl(self, cafile, capath, cadata);
exit:
@@ -624,17 +676,54 @@ _ssl__SSLContext__wrap_socket(PySSLContext *self, PyObject *const *args, Py_ssiz
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"sock", "server_side", "server_hostname", "owner", "session", NULL};
- static _PyArg_Parser _parser = {"O!i|O$OO:_wrap_socket", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "_wrap_socket", 0};
+ PyObject *argsbuf[5];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
PyObject *sock;
int server_side;
PyObject *hostname_obj = Py_None;
PyObject *owner = Py_None;
PyObject *session = Py_None;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- PySocketModule.Sock_Type, &sock, &server_side, &hostname_obj, &owner, &session)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!PyObject_TypeCheck(args[0], PySocketModule.Sock_Type)) {
+ _PyArg_BadArgument("_wrap_socket", 1, (PySocketModule.Sock_Type)->tp_name, args[0]);
goto exit;
}
+ sock = args[0];
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ server_side = _PyLong_AsInt(args[1]);
+ if (server_side == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[2]) {
+ hostname_obj = args[2];
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+skip_optional_pos:
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (args[3]) {
+ owner = args[3];
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ session = args[4];
+skip_optional_kwonly:
return_value = _ssl__SSLContext__wrap_socket_impl(self, sock, server_side, hostname_obj, owner, session);
exit:
@@ -661,7 +750,9 @@ _ssl__SSLContext__wrap_bio(PySSLContext *self, PyObject *const *args, Py_ssize_t
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"incoming", "outgoing", "server_side", "server_hostname", "owner", "session", NULL};
- static _PyArg_Parser _parser = {"O!O!i|O$OO:_wrap_bio", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "_wrap_bio", 0};
+ PyObject *argsbuf[6];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 3;
PySSLMemoryBIO *incoming;
PySSLMemoryBIO *outgoing;
int server_side;
@@ -669,10 +760,50 @@ _ssl__SSLContext__wrap_bio(PySSLContext *self, PyObject *const *args, Py_ssize_t
PyObject *owner = Py_None;
PyObject *session = Py_None;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &PySSLMemoryBIO_Type, &incoming, &PySSLMemoryBIO_Type, &outgoing, &server_side, &hostname_obj, &owner, &session)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 4, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!PyObject_TypeCheck(args[0], &PySSLMemoryBIO_Type)) {
+ _PyArg_BadArgument("_wrap_bio", 1, (&PySSLMemoryBIO_Type)->tp_name, args[0]);
+ goto exit;
+ }
+ incoming = (PySSLMemoryBIO *)args[0];
+ if (!PyObject_TypeCheck(args[1], &PySSLMemoryBIO_Type)) {
+ _PyArg_BadArgument("_wrap_bio", 2, (&PySSLMemoryBIO_Type)->tp_name, args[1]);
+ goto exit;
+ }
+ outgoing = (PySSLMemoryBIO *)args[1];
+ if (PyFloat_Check(args[2])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ server_side = _PyLong_AsInt(args[2]);
+ if (server_side == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[3]) {
+ hostname_obj = args[3];
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+skip_optional_pos:
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (args[4]) {
+ owner = args[4];
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ session = args[5];
+skip_optional_kwonly:
return_value = _ssl__SSLContext__wrap_bio_impl(self, incoming, outgoing, server_side, hostname_obj, owner, session);
exit:
@@ -772,13 +903,23 @@ _ssl__SSLContext_get_ca_certs(PySSLContext *self, PyObject *const *args, Py_ssiz
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"binary_form", NULL};
- static _PyArg_Parser _parser = {"|p:get_ca_certs", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "get_ca_certs", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
int binary_form = 0;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &binary_form)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ binary_form = PyObject_IsTrue(args[0]);
+ if (binary_form < 0) {
+ goto exit;
+ }
+skip_optional_pos:
return_value = _ssl__SSLContext_get_ca_certs_impl(self, binary_form);
exit:
@@ -1131,14 +1272,37 @@ _ssl_txt2obj(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"txt", "name", NULL};
- static _PyArg_Parser _parser = {"s|p:txt2obj", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "txt2obj", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
const char *txt;
int name = 0;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &txt, &name)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!PyUnicode_Check(args[0])) {
+ _PyArg_BadArgument("txt2obj", 1, "str", args[0]);
+ goto exit;
+ }
+ Py_ssize_t txt_length;
+ txt = PyUnicode_AsUTF8AndSize(args[0], &txt_length);
+ if (txt == NULL) {
+ goto exit;
+ }
+ if (strlen(txt) != (size_t)txt_length) {
+ PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ name = PyObject_IsTrue(args[1]);
+ if (name < 0) {
+ goto exit;
+ }
+skip_optional_pos:
return_value = _ssl_txt2obj_impl(module, txt, name);
exit:
@@ -1203,11 +1367,25 @@ _ssl_enum_certificates(PyObject *module, PyObject *const *args, Py_ssize_t nargs
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"store_name", NULL};
- static _PyArg_Parser _parser = {"s:enum_certificates", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "enum_certificates", 0};
+ PyObject *argsbuf[1];
const char *store_name;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &store_name)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!PyUnicode_Check(args[0])) {
+ _PyArg_BadArgument("enum_certificates", 1, "str", args[0]);
+ goto exit;
+ }
+ Py_ssize_t store_name_length;
+ store_name = PyUnicode_AsUTF8AndSize(args[0], &store_name_length);
+ if (store_name == NULL) {
+ goto exit;
+ }
+ if (strlen(store_name) != (size_t)store_name_length) {
+ PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _ssl_enum_certificates_impl(module, store_name);
@@ -1242,11 +1420,25 @@ _ssl_enum_crls(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"store_name", NULL};
- static _PyArg_Parser _parser = {"s:enum_crls", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "enum_crls", 0};
+ PyObject *argsbuf[1];
const char *store_name;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &store_name)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!PyUnicode_Check(args[0])) {
+ _PyArg_BadArgument("enum_crls", 1, "str", args[0]);
+ goto exit;
+ }
+ Py_ssize_t store_name_length;
+ store_name = PyUnicode_AsUTF8AndSize(args[0], &store_name_length);
+ if (store_name == NULL) {
+ goto exit;
+ }
+ if (strlen(store_name) != (size_t)store_name_length) {
+ PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _ssl_enum_crls_impl(module, store_name);
@@ -1284,4 +1476,4 @@ exit:
#ifndef _SSL_ENUM_CRLS_METHODDEF
#define _SSL_ENUM_CRLS_METHODDEF
#endif /* !defined(_SSL_ENUM_CRLS_METHODDEF) */
-/*[clinic end generated code: output=ac3fb15ca27500f2 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=a399d0eb393b6fab input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_struct.c.h b/Modules/clinic/_struct.c.h
index 2cc2d21..908c442 100644
--- a/Modules/clinic/_struct.c.h
+++ b/Modules/clinic/_struct.c.h
@@ -21,13 +21,17 @@ Struct___init__(PyObject *self, PyObject *args, PyObject *kwargs)
{
int return_value = -1;
static const char * const _keywords[] = {"format", NULL};
- static _PyArg_Parser _parser = {"O:Struct", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "Struct", 0};
+ PyObject *argsbuf[1];
+ PyObject * const *fastargs;
+ Py_ssize_t nargs = PyTuple_GET_SIZE(args);
PyObject *format;
- if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
- &format)) {
+ fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 1, 0, argsbuf);
+ if (!fastargs) {
goto exit;
}
+ format = fastargs[0];
return_value = Struct___init___impl((PyStructObject *)self, format);
exit:
@@ -100,14 +104,44 @@ Struct_unpack_from(PyStructObject *self, PyObject *const *args, Py_ssize_t nargs
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"buffer", "offset", NULL};
- static _PyArg_Parser _parser = {"y*|n:unpack_from", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "unpack_from", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
Py_buffer buffer = {NULL, NULL};
Py_ssize_t offset = 0;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &buffer, &offset)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (PyObject_GetBuffer(args[0], &buffer, PyBUF_SIMPLE) != 0) {
+ goto exit;
+ }
+ if (!PyBuffer_IsContiguous(&buffer, 'C')) {
+ _PyArg_BadArgument("unpack_from", 1, "contiguous buffer", args[0]);
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ {
+ Py_ssize_t ival = -1;
+ PyObject *iobj = PyNumber_Index(args[1]);
+ if (iobj != NULL) {
+ ival = PyLong_AsSsize_t(iobj);
+ Py_DECREF(iobj);
+ }
+ if (ival == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ offset = ival;
+ }
+skip_optional_pos:
return_value = Struct_unpack_from_impl(self, &buffer, offset);
exit:
@@ -257,15 +291,48 @@ unpack_from(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"", "buffer", "offset", NULL};
- static _PyArg_Parser _parser = {"O&y*|n:unpack_from", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "unpack_from", 0};
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
PyStructObject *s_object = NULL;
Py_buffer buffer = {NULL, NULL};
Py_ssize_t offset = 0;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- cache_struct_converter, &s_object, &buffer, &offset)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!cache_struct_converter(args[0], &s_object)) {
+ goto exit;
+ }
+ if (PyObject_GetBuffer(args[1], &buffer, PyBUF_SIMPLE) != 0) {
goto exit;
}
+ if (!PyBuffer_IsContiguous(&buffer, 'C')) {
+ _PyArg_BadArgument("unpack_from", 2, "contiguous buffer", args[1]);
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (PyFloat_Check(args[2])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ {
+ Py_ssize_t ival = -1;
+ PyObject *iobj = PyNumber_Index(args[2]);
+ if (iobj != NULL) {
+ ival = PyLong_AsSsize_t(iobj);
+ Py_DECREF(iobj);
+ }
+ if (ival == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ offset = ival;
+ }
+skip_optional_pos:
return_value = unpack_from_impl(module, s_object, &buffer, offset);
exit:
@@ -319,4 +386,4 @@ exit:
return return_value;
}
-/*[clinic end generated code: output=ac595db9d2b271aa input=a9049054013a1b77]*/
+/*[clinic end generated code: output=b642e1002d25ebdd input=a9049054013a1b77]*/
diff --git a/Modules/clinic/binascii.c.h b/Modules/clinic/binascii.c.h
index 3295833..4043d89 100644
--- a/Modules/clinic/binascii.c.h
+++ b/Modules/clinic/binascii.c.h
@@ -50,14 +50,36 @@ binascii_b2a_uu(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"", "backtick", NULL};
- static _PyArg_Parser _parser = {"y*|$i:b2a_uu", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "b2a_uu", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
Py_buffer data = {NULL, NULL};
int backtick = 0;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &data, &backtick)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
+ goto exit;
+ }
+ if (!PyBuffer_IsContiguous(&data, 'C')) {
+ _PyArg_BadArgument("b2a_uu", 1, "contiguous buffer", args[0]);
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ backtick = _PyLong_AsInt(args[1]);
+ if (backtick == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+skip_optional_kwonly:
return_value = binascii_b2a_uu_impl(module, &data, backtick);
exit:
@@ -117,14 +139,36 @@ binascii_b2a_base64(PyObject *module, PyObject *const *args, Py_ssize_t nargs, P
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"", "newline", NULL};
- static _PyArg_Parser _parser = {"y*|$i:b2a_base64", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "b2a_base64", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
Py_buffer data = {NULL, NULL};
int newline = 1;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &data, &newline)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
+ goto exit;
+ }
+ if (!PyBuffer_IsContiguous(&data, 'C')) {
+ _PyArg_BadArgument("b2a_base64", 1, "contiguous buffer", args[0]);
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ newline = _PyLong_AsInt(args[1]);
+ if (newline == -1 && PyErr_Occurred()) {
goto exit;
}
+skip_optional_kwonly:
return_value = binascii_b2a_base64_impl(module, &data, newline);
exit:
@@ -548,14 +592,32 @@ binascii_a2b_qp(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"data", "header", NULL};
- static _PyArg_Parser _parser = {"O&|i:a2b_qp", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "a2b_qp", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
Py_buffer data = {NULL, NULL};
int header = 0;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- ascii_buffer_converter, &data, &header)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!ascii_buffer_converter(args[0], &data)) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ header = _PyLong_AsInt(args[1]);
+ if (header == -1 && PyErr_Occurred()) {
goto exit;
}
+skip_optional_pos:
return_value = binascii_a2b_qp_impl(module, &data, header);
exit:
@@ -588,16 +650,66 @@ binascii_b2a_qp(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"data", "quotetabs", "istext", "header", NULL};
- static _PyArg_Parser _parser = {"y*|iii:b2a_qp", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "b2a_qp", 0};
+ PyObject *argsbuf[4];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
Py_buffer data = {NULL, NULL};
int quotetabs = 0;
int istext = 1;
int header = 0;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &data, &quotetabs, &istext, &header)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 4, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
+ goto exit;
+ }
+ if (!PyBuffer_IsContiguous(&data, 'C')) {
+ _PyArg_BadArgument("b2a_qp", 1, "contiguous buffer", args[0]);
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[1]) {
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ quotetabs = _PyLong_AsInt(args[1]);
+ if (quotetabs == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ if (args[2]) {
+ if (PyFloat_Check(args[2])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ istext = _PyLong_AsInt(args[2]);
+ if (istext == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ if (PyFloat_Check(args[3])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ header = _PyLong_AsInt(args[3]);
+ if (header == -1 && PyErr_Occurred()) {
goto exit;
}
+skip_optional_pos:
return_value = binascii_b2a_qp_impl(module, &data, quotetabs, istext, header);
exit:
@@ -608,4 +720,4 @@ exit:
return return_value;
}
-/*[clinic end generated code: output=7210a01a718da4a0 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=a4a38e162605aca2 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/cmathmodule.c.h b/Modules/clinic/cmathmodule.c.h
index cc1b8f2..83c498c 100644
--- a/Modules/clinic/cmathmodule.c.h
+++ b/Modules/clinic/cmathmodule.c.h
@@ -897,17 +897,44 @@ cmath_isclose(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"a", "b", "rel_tol", "abs_tol", NULL};
- static _PyArg_Parser _parser = {"DD|$dd:isclose", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "isclose", 0};
+ PyObject *argsbuf[4];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
Py_complex a;
Py_complex b;
double rel_tol = 1e-09;
double abs_tol = 0.0;
int _return_value;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &a, &b, &rel_tol, &abs_tol)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ a = PyComplex_AsCComplex(args[0]);
+ if (PyErr_Occurred()) {
+ goto exit;
+ }
+ b = PyComplex_AsCComplex(args[1]);
+ if (PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (args[2]) {
+ rel_tol = PyFloat_AsDouble(args[2]);
+ if (PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ abs_tol = PyFloat_AsDouble(args[3]);
+ if (PyErr_Occurred()) {
+ goto exit;
+ }
+skip_optional_kwonly:
_return_value = cmath_isclose_impl(module, a, b, rel_tol, abs_tol);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
@@ -917,4 +944,4 @@ cmath_isclose(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
exit:
return return_value;
}
-/*[clinic end generated code: output=86a365d23f34aaff input=a9049054013a1b77]*/
+/*[clinic end generated code: output=c7afb866e593fa45 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/gcmodule.c.h b/Modules/clinic/gcmodule.c.h
index eece045..22d2aa4 100644
--- a/Modules/clinic/gcmodule.c.h
+++ b/Modules/clinic/gcmodule.c.h
@@ -89,14 +89,29 @@ gc_collect(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"generation", NULL};
- static _PyArg_Parser _parser = {"|i:collect", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "collect", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
int generation = NUM_GENERATIONS - 1;
Py_ssize_t _return_value;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &generation)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ generation = _PyLong_AsInt(args[0]);
+ if (generation == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+skip_optional_pos:
_return_value = gc_collect_impl(module, generation);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
@@ -238,13 +253,22 @@ gc_get_objects(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"generation", NULL};
- static _PyArg_Parser _parser = {"|O&:get_objects", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "get_objects", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
Py_ssize_t generation = -1;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- _Py_convert_optional_to_ssize_t, &generation)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (!_Py_convert_optional_to_ssize_t(args[0], &generation)) {
goto exit;
}
+skip_optional_pos:
return_value = gc_get_objects_impl(module, generation);
exit:
@@ -349,4 +373,4 @@ gc_get_freeze_count(PyObject *module, PyObject *Py_UNUSED(ignored))
exit:
return return_value;
}
-/*[clinic end generated code: output=d692bf475f0bb096 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=e40d384b1f0d513c input=a9049054013a1b77]*/
diff --git a/Modules/clinic/grpmodule.c.h b/Modules/clinic/grpmodule.c.h
index c2e54c9..ae99c50 100644
--- a/Modules/clinic/grpmodule.c.h
+++ b/Modules/clinic/grpmodule.c.h
@@ -21,13 +21,15 @@ grp_getgrgid(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"id", NULL};
- static _PyArg_Parser _parser = {"O:getgrgid", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "getgrgid", 0};
+ PyObject *argsbuf[1];
PyObject *id;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &id)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ id = args[0];
return_value = grp_getgrgid_impl(module, id);
exit:
@@ -53,13 +55,22 @@ grp_getgrnam(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"name", NULL};
- static _PyArg_Parser _parser = {"U:getgrnam", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "getgrnam", 0};
+ PyObject *argsbuf[1];
PyObject *name;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &name)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!PyUnicode_Check(args[0])) {
+ _PyArg_BadArgument("getgrnam", 1, "str", args[0]);
+ goto exit;
+ }
+ if (PyUnicode_READY(args[0]) == -1) {
+ goto exit;
+ }
+ name = args[0];
return_value = grp_getgrnam_impl(module, name);
exit:
@@ -86,4 +97,4 @@ grp_getgrall(PyObject *module, PyObject *Py_UNUSED(ignored))
{
return grp_getgrall_impl(module);
}
-/*[clinic end generated code: output=ab10233f6015bc0a input=a9049054013a1b77]*/
+/*[clinic end generated code: output=2aa6c60873d41ee8 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/itertoolsmodule.c.h b/Modules/clinic/itertoolsmodule.c.h
index bcf4c5f..b43ce64 100644
--- a/Modules/clinic/itertoolsmodule.c.h
+++ b/Modules/clinic/itertoolsmodule.c.h
@@ -23,14 +23,24 @@ itertools_groupby(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"iterable", "key", NULL};
- static _PyArg_Parser _parser = {"O|O:groupby", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "groupby", 0};
+ PyObject *argsbuf[2];
+ PyObject * const *fastargs;
+ Py_ssize_t nargs = PyTuple_GET_SIZE(args);
+ Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 1;
PyObject *it;
PyObject *keyfunc = Py_None;
- if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
- &it, &keyfunc)) {
+ fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 2, 0, argsbuf);
+ if (!fastargs) {
goto exit;
}
+ it = fastargs[0];
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ keyfunc = fastargs[1];
+skip_optional_pos:
return_value = itertools_groupby_impl(type, it, keyfunc);
exit:
@@ -334,14 +344,35 @@ itertools_combinations(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"iterable", "r", NULL};
- static _PyArg_Parser _parser = {"On:combinations", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "combinations", 0};
+ PyObject *argsbuf[2];
+ PyObject * const *fastargs;
+ Py_ssize_t nargs = PyTuple_GET_SIZE(args);
PyObject *iterable;
Py_ssize_t r;
- if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
- &iterable, &r)) {
+ fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 2, 2, 0, argsbuf);
+ if (!fastargs) {
+ goto exit;
+ }
+ iterable = fastargs[0];
+ if (PyFloat_Check(fastargs[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
goto exit;
}
+ {
+ Py_ssize_t ival = -1;
+ PyObject *iobj = PyNumber_Index(fastargs[1]);
+ if (iobj != NULL) {
+ ival = PyLong_AsSsize_t(iobj);
+ Py_DECREF(iobj);
+ }
+ if (ival == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ r = ival;
+ }
return_value = itertools_combinations_impl(type, iterable, r);
exit:
@@ -366,14 +397,35 @@ itertools_combinations_with_replacement(PyTypeObject *type, PyObject *args, PyOb
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"iterable", "r", NULL};
- static _PyArg_Parser _parser = {"On:combinations_with_replacement", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "combinations_with_replacement", 0};
+ PyObject *argsbuf[2];
+ PyObject * const *fastargs;
+ Py_ssize_t nargs = PyTuple_GET_SIZE(args);
PyObject *iterable;
Py_ssize_t r;
- if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
- &iterable, &r)) {
+ fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 2, 2, 0, argsbuf);
+ if (!fastargs) {
+ goto exit;
+ }
+ iterable = fastargs[0];
+ if (PyFloat_Check(fastargs[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
goto exit;
}
+ {
+ Py_ssize_t ival = -1;
+ PyObject *iobj = PyNumber_Index(fastargs[1]);
+ if (iobj != NULL) {
+ ival = PyLong_AsSsize_t(iobj);
+ Py_DECREF(iobj);
+ }
+ if (ival == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ r = ival;
+ }
return_value = itertools_combinations_with_replacement_impl(type, iterable, r);
exit:
@@ -397,14 +449,24 @@ itertools_permutations(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"iterable", "r", NULL};
- static _PyArg_Parser _parser = {"O|O:permutations", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "permutations", 0};
+ PyObject *argsbuf[2];
+ PyObject * const *fastargs;
+ Py_ssize_t nargs = PyTuple_GET_SIZE(args);
+ Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 1;
PyObject *iterable;
PyObject *robj = Py_None;
- if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
- &iterable, &robj)) {
+ fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 2, 0, argsbuf);
+ if (!fastargs) {
goto exit;
}
+ iterable = fastargs[0];
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ robj = fastargs[1];
+skip_optional_pos:
return_value = itertools_permutations_impl(type, iterable, robj);
exit:
@@ -426,15 +488,35 @@ itertools_accumulate(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"iterable", "func", "initial", NULL};
- static _PyArg_Parser _parser = {"O|O$O:accumulate", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "accumulate", 0};
+ PyObject *argsbuf[3];
+ PyObject * const *fastargs;
+ Py_ssize_t nargs = PyTuple_GET_SIZE(args);
+ Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 1;
PyObject *iterable;
PyObject *binop = Py_None;
PyObject *initial = Py_None;
- if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
- &iterable, &binop, &initial)) {
+ fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 2, 0, argsbuf);
+ if (!fastargs) {
goto exit;
}
+ iterable = fastargs[0];
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (fastargs[1]) {
+ binop = fastargs[1];
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+skip_optional_pos:
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ initial = fastargs[2];
+skip_optional_kwonly:
return_value = itertools_accumulate_impl(type, iterable, binop, initial);
exit:
@@ -458,14 +540,19 @@ itertools_compress(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"data", "selectors", NULL};
- static _PyArg_Parser _parser = {"OO:compress", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "compress", 0};
+ PyObject *argsbuf[2];
+ PyObject * const *fastargs;
+ Py_ssize_t nargs = PyTuple_GET_SIZE(args);
PyObject *seq1;
PyObject *seq2;
- if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
- &seq1, &seq2)) {
+ fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 2, 2, 0, argsbuf);
+ if (!fastargs) {
goto exit;
}
+ seq1 = fastargs[0];
+ seq2 = fastargs[1];
return_value = itertools_compress_impl(type, seq1, seq2);
exit:
@@ -527,17 +614,32 @@ itertools_count(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"start", "step", NULL};
- static _PyArg_Parser _parser = {"|OO:count", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "count", 0};
+ PyObject *argsbuf[2];
+ PyObject * const *fastargs;
+ Py_ssize_t nargs = PyTuple_GET_SIZE(args);
+ Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0;
PyObject *long_cnt = NULL;
PyObject *long_step = NULL;
- if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
- &long_cnt, &long_step)) {
+ fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 2, 0, argsbuf);
+ if (!fastargs) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (fastargs[0]) {
+ long_cnt = fastargs[0];
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ long_step = fastargs[1];
+skip_optional_pos:
return_value = itertools_count_impl(type, long_cnt, long_step);
exit:
return return_value;
}
-/*[clinic end generated code: output=3d0ca69707b60715 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=04c49debcae96003 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/mathmodule.c.h b/Modules/clinic/mathmodule.c.h
index b99a8de..1806a01 100644
--- a/Modules/clinic/mathmodule.c.h
+++ b/Modules/clinic/mathmodule.c.h
@@ -536,17 +536,44 @@ math_isclose(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"a", "b", "rel_tol", "abs_tol", NULL};
- static _PyArg_Parser _parser = {"dd|$dd:isclose", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "isclose", 0};
+ PyObject *argsbuf[4];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
double a;
double b;
double rel_tol = 1e-09;
double abs_tol = 0.0;
int _return_value;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &a, &b, &rel_tol, &abs_tol)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ a = PyFloat_AsDouble(args[0]);
+ if (PyErr_Occurred()) {
+ goto exit;
+ }
+ b = PyFloat_AsDouble(args[1]);
+ if (PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (args[2]) {
+ rel_tol = PyFloat_AsDouble(args[2]);
+ if (PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ abs_tol = PyFloat_AsDouble(args[3]);
+ if (PyErr_Occurred()) {
+ goto exit;
+ }
+skip_optional_kwonly:
_return_value = math_isclose_impl(module, a, b, rel_tol, abs_tol);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
@@ -580,17 +607,25 @@ math_prod(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *k
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"", "start", NULL};
- static _PyArg_Parser _parser = {"O|$O:prod", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "prod", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *iterable;
PyObject *start = NULL;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &iterable, &start)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ iterable = args[0];
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ start = args[1];
+skip_optional_kwonly:
return_value = math_prod_impl(module, iterable, start);
exit:
return return_value;
}
-/*[clinic end generated code: output=20505690ca6fe402 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=96e71135dce41c48 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/md5module.c.h b/Modules/clinic/md5module.c.h
index 67cb48c..12484cc 100644
--- a/Modules/clinic/md5module.c.h
+++ b/Modules/clinic/md5module.c.h
@@ -82,16 +82,23 @@ _md5_md5(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", NULL};
- static _PyArg_Parser _parser = {"|O:md5", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "md5", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *string = NULL;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &string)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ string = args[0];
+skip_optional_pos:
return_value = _md5_md5_impl(module, string);
exit:
return return_value;
}
-/*[clinic end generated code: output=83cb1aef575f13bc input=a9049054013a1b77]*/
+/*[clinic end generated code: output=53133f08cf9095fc input=a9049054013a1b77]*/
diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h
index dc5f3b1..55f2cbb 100644
--- a/Modules/clinic/posixmodule.c.h
+++ b/Modules/clinic/posixmodule.c.h
@@ -38,15 +38,36 @@ os_stat(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwn
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", "dir_fd", "follow_symlinks", NULL};
- static _PyArg_Parser _parser = {"O&|$O&p:stat", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "stat", 0};
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
path_t path = PATH_T_INITIALIZE("stat", "path", 0, 1);
int dir_fd = DEFAULT_DIR_FD;
int follow_symlinks = 1;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path, FSTATAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &path)) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (args[1]) {
+ if (!FSTATAT_DIR_FD_CONVERTER(args[1], &dir_fd)) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ follow_symlinks = PyObject_IsTrue(args[2]);
+ if (follow_symlinks < 0) {
goto exit;
}
+skip_optional_kwonly:
return_value = os_stat_impl(module, &path, dir_fd, follow_symlinks);
exit:
@@ -76,14 +97,26 @@ os_lstat(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", "dir_fd", NULL};
- static _PyArg_Parser _parser = {"O&|$O&:lstat", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "lstat", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
path_t path = PATH_T_INITIALIZE("lstat", "path", 0, 0);
int dir_fd = DEFAULT_DIR_FD;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path, FSTATAT_DIR_FD_CONVERTER, &dir_fd)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &path)) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (!FSTATAT_DIR_FD_CONVERTER(args[1], &dir_fd)) {
+ goto exit;
+ }
+skip_optional_kwonly:
return_value = os_lstat_impl(module, &path, dir_fd);
exit:
@@ -137,7 +170,9 @@ os_access(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *k
{
PyObject *return_value = 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};
+ static _PyArg_Parser _parser = {NULL, _keywords, "access", 0};
+ PyObject *argsbuf[5];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
path_t path = PATH_T_INITIALIZE("access", "path", 0, 0);
int mode;
int dir_fd = DEFAULT_DIR_FD;
@@ -145,10 +180,47 @@ os_access(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *k
int follow_symlinks = 1;
int _return_value;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path, &mode, FACCESSAT_DIR_FD_CONVERTER, &dir_fd, &effective_ids, &follow_symlinks)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &path)) {
goto exit;
}
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ mode = _PyLong_AsInt(args[1]);
+ if (mode == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (args[2]) {
+ if (!FACCESSAT_DIR_FD_CONVERTER(args[2], &dir_fd)) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ if (args[3]) {
+ effective_ids = PyObject_IsTrue(args[3]);
+ if (effective_ids < 0) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ follow_symlinks = PyObject_IsTrue(args[4]);
+ if (follow_symlinks < 0) {
+ goto exit;
+ }
+skip_optional_kwonly:
_return_value = os_access_impl(module, &path, mode, dir_fd, effective_ids, follow_symlinks);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
@@ -245,11 +317,15 @@ os_chdir(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", NULL};
- static _PyArg_Parser _parser = {"O&:chdir", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "chdir", 0};
+ PyObject *argsbuf[1];
path_t path = PATH_T_INITIALIZE("chdir", "path", 0, PATH_HAVE_FCHDIR);
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &path)) {
goto exit;
}
return_value = os_chdir_impl(module, &path);
@@ -283,11 +359,15 @@ os_fchdir(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *k
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"fd", NULL};
- static _PyArg_Parser _parser = {"O&:fchdir", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "fchdir", 0};
+ PyObject *argsbuf[1];
int fd;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- fildes_converter, &fd)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!fildes_converter(args[0], &fd)) {
goto exit;
}
return_value = os_fchdir_impl(module, fd);
@@ -336,16 +416,46 @@ os_chmod(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", "mode", "dir_fd", "follow_symlinks", NULL};
- static _PyArg_Parser _parser = {"O&i|$O&p:chmod", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "chmod", 0};
+ PyObject *argsbuf[4];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
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_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path, &mode, FCHMODAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &path)) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ mode = _PyLong_AsInt(args[1]);
+ if (mode == -1 && PyErr_Occurred()) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (args[2]) {
+ if (!FCHMODAT_DIR_FD_CONVERTER(args[2], &dir_fd)) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ follow_symlinks = PyObject_IsTrue(args[3]);
+ if (follow_symlinks < 0) {
+ goto exit;
+ }
+skip_optional_kwonly:
return_value = os_chmod_impl(module, &path, mode, dir_fd, follow_symlinks);
exit:
@@ -376,12 +486,31 @@ os_fchmod(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *k
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"fd", "mode", NULL};
- static _PyArg_Parser _parser = {"ii:fchmod", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "fchmod", 0};
+ PyObject *argsbuf[2];
int fd;
int mode;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &fd, &mode)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ fd = _PyLong_AsInt(args[0]);
+ if (fd == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ mode = _PyLong_AsInt(args[1]);
+ if (mode == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = os_fchmod_impl(module, fd, mode);
@@ -414,12 +543,25 @@ os_lchmod(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *k
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", "mode", NULL};
- static _PyArg_Parser _parser = {"O&i:lchmod", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "lchmod", 0};
+ PyObject *argsbuf[2];
path_t path = PATH_T_INITIALIZE("lchmod", "path", 0, 0);
int mode;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path, &mode)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &path)) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ mode = _PyLong_AsInt(args[1]);
+ if (mode == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = os_lchmod_impl(module, &path, mode);
@@ -459,15 +601,33 @@ os_chflags(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", "flags", "follow_symlinks", NULL};
- static _PyArg_Parser _parser = {"O&k|p:chflags", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "chflags", 0};
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
path_t path = PATH_T_INITIALIZE("chflags", "path", 0, 0);
unsigned long flags;
int follow_symlinks = 1;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path, &flags, &follow_symlinks)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!path_converter(args[0], &path)) {
+ goto exit;
+ }
+ if (!PyLong_Check(args[1])) {
+ _PyArg_BadArgument("chflags", 2, "int", args[1]);
+ goto exit;
+ }
+ flags = PyLong_AsUnsignedLongMask(args[1]);
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ follow_symlinks = PyObject_IsTrue(args[2]);
+ if (follow_symlinks < 0) {
+ goto exit;
+ }
+skip_optional_pos:
return_value = os_chflags_impl(module, &path, flags, follow_symlinks);
exit:
@@ -501,14 +661,23 @@ os_lchflags(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", "flags", NULL};
- static _PyArg_Parser _parser = {"O&k:lchflags", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "lchflags", 0};
+ PyObject *argsbuf[2];
path_t path = PATH_T_INITIALIZE("lchflags", "path", 0, 0);
unsigned long flags;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path, &flags)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &path)) {
+ goto exit;
+ }
+ if (!PyLong_Check(args[1])) {
+ _PyArg_BadArgument("lchflags", 2, "int", args[1]);
goto exit;
}
+ flags = PyLong_AsUnsignedLongMask(args[1]);
return_value = os_lchflags_impl(module, &path, flags);
exit:
@@ -539,11 +708,15 @@ os_chroot(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *k
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", NULL};
- static _PyArg_Parser _parser = {"O&:chroot", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "chroot", 0};
+ PyObject *argsbuf[1];
path_t path = PATH_T_INITIALIZE("chroot", "path", 0, 0);
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &path)) {
goto exit;
}
return_value = os_chroot_impl(module, &path);
@@ -576,11 +749,15 @@ os_fsync(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"fd", NULL};
- static _PyArg_Parser _parser = {"O&:fsync", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "fsync", 0};
+ PyObject *argsbuf[1];
int fd;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- fildes_converter, &fd)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!fildes_converter(args[0], &fd)) {
goto exit;
}
return_value = os_fsync_impl(module, fd);
@@ -632,11 +809,15 @@ os_fdatasync(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"fd", NULL};
- static _PyArg_Parser _parser = {"O&:fdatasync", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "fdatasync", 0};
+ PyObject *argsbuf[1];
int fd;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- fildes_converter, &fd)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!fildes_converter(args[0], &fd)) {
goto exit;
}
return_value = os_fdatasync_impl(module, fd);
@@ -691,17 +872,44 @@ os_chown(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
{
PyObject *return_value = 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};
+ static _PyArg_Parser _parser = {NULL, _keywords, "chown", 0};
+ PyObject *argsbuf[5];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 3;
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_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid, FCHOWNAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 3, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &path)) {
goto exit;
}
+ if (!_Py_Uid_Converter(args[1], &uid)) {
+ goto exit;
+ }
+ if (!_Py_Gid_Converter(args[2], &gid)) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (args[3]) {
+ if (!FCHOWNAT_DIR_FD_CONVERTER(args[3], &dir_fd)) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ follow_symlinks = PyObject_IsTrue(args[4]);
+ if (follow_symlinks < 0) {
+ goto exit;
+ }
+skip_optional_kwonly:
return_value = os_chown_impl(module, &path, uid, gid, dir_fd, follow_symlinks);
exit:
@@ -734,13 +942,29 @@ os_fchown(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *k
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"fd", "uid", "gid", NULL};
- static _PyArg_Parser _parser = {"iO&O&:fchown", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "fchown", 0};
+ PyObject *argsbuf[3];
int fd;
uid_t uid;
gid_t gid;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &fd, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 3, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ fd = _PyLong_AsInt(args[0]);
+ if (fd == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!_Py_Uid_Converter(args[1], &uid)) {
+ goto exit;
+ }
+ if (!_Py_Gid_Converter(args[2], &gid)) {
goto exit;
}
return_value = os_fchown_impl(module, fd, uid, gid);
@@ -773,13 +997,23 @@ os_lchown(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *k
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", "uid", "gid", NULL};
- static _PyArg_Parser _parser = {"O&O&O&:lchown", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "lchown", 0};
+ PyObject *argsbuf[3];
path_t path = PATH_T_INITIALIZE("lchown", "path", 0, 0);
uid_t uid;
gid_t gid;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 3, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &path)) {
+ goto exit;
+ }
+ if (!_Py_Uid_Converter(args[1], &uid)) {
+ goto exit;
+ }
+ if (!_Py_Gid_Converter(args[2], &gid)) {
goto exit;
}
return_value = os_lchown_impl(module, &path, uid, gid);
@@ -860,17 +1094,49 @@ os_link(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwn
{
PyObject *return_value = 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};
+ static _PyArg_Parser _parser = {NULL, _keywords, "link", 0};
+ PyObject *argsbuf[5];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
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_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &src, path_converter, &dst, dir_fd_converter, &src_dir_fd, dir_fd_converter, &dst_dir_fd, &follow_symlinks)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &src)) {
+ goto exit;
+ }
+ if (!path_converter(args[1], &dst)) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (args[2]) {
+ if (!dir_fd_converter(args[2], &src_dir_fd)) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ if (args[3]) {
+ if (!dir_fd_converter(args[3], &dst_dir_fd)) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ follow_symlinks = PyObject_IsTrue(args[4]);
+ if (follow_symlinks < 0) {
+ goto exit;
+ }
+skip_optional_kwonly:
return_value = os_link_impl(module, &src, &dst, src_dir_fd, dst_dir_fd, follow_symlinks);
exit:
@@ -912,13 +1178,22 @@ os_listdir(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", NULL};
- static _PyArg_Parser _parser = {"|O&:listdir", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "listdir", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
path_t path = PATH_T_INITIALIZE("listdir", "path", 1, PATH_HAVE_FDOPENDIR);
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (!path_converter(args[0], &path)) {
goto exit;
}
+skip_optional_pos:
return_value = os_listdir_impl(module, &path);
exit:
@@ -1027,11 +1302,15 @@ os__getvolumepathname(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", NULL};
- static _PyArg_Parser _parser = {"O&:_getvolumepathname", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "_getvolumepathname", 0};
+ PyObject *argsbuf[1];
path_t path = PATH_T_INITIALIZE("_getvolumepathname", "path", 0, 0);
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &path)) {
goto exit;
}
return_value = os__getvolumepathname_impl(module, &path);
@@ -1069,15 +1348,45 @@ os_mkdir(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", "mode", "dir_fd", NULL};
- static _PyArg_Parser _parser = {"O&|i$O&:mkdir", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "mkdir", 0};
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
path_t path = PATH_T_INITIALIZE("mkdir", "path", 0, 0);
int mode = 511;
int dir_fd = DEFAULT_DIR_FD;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path, &mode, MKDIRAT_DIR_FD_CONVERTER, &dir_fd)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &path)) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[1]) {
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ mode = _PyLong_AsInt(args[1]);
+ if (mode == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+skip_optional_pos:
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (!MKDIRAT_DIR_FD_CONVERTER(args[2], &dir_fd)) {
goto exit;
}
+skip_optional_kwonly:
return_value = os_mkdir_impl(module, &path, mode, dir_fd);
exit:
@@ -1143,12 +1452,31 @@ os_getpriority(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"which", "who", NULL};
- static _PyArg_Parser _parser = {"ii:getpriority", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "getpriority", 0};
+ PyObject *argsbuf[2];
int which;
int who;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &which, &who)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ which = _PyLong_AsInt(args[0]);
+ if (which == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ who = _PyLong_AsInt(args[1]);
+ if (who == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = os_getpriority_impl(module, which, who);
@@ -1178,13 +1506,41 @@ os_setpriority(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"which", "who", "priority", NULL};
- static _PyArg_Parser _parser = {"iii:setpriority", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "setpriority", 0};
+ PyObject *argsbuf[3];
int which;
int who;
int priority;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &which, &who, &priority)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 3, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ which = _PyLong_AsInt(args[0]);
+ if (which == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ who = _PyLong_AsInt(args[1]);
+ if (who == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[2])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ priority = _PyLong_AsInt(args[2]);
+ if (priority == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = os_setpriority_impl(module, which, who, priority);
@@ -1219,16 +1575,39 @@ os_rename(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *k
{
PyObject *return_value = 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};
+ static _PyArg_Parser _parser = {NULL, _keywords, "rename", 0};
+ PyObject *argsbuf[4];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
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_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &src, path_converter, &dst, dir_fd_converter, &src_dir_fd, dir_fd_converter, &dst_dir_fd)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &src)) {
+ goto exit;
+ }
+ if (!path_converter(args[1], &dst)) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (args[2]) {
+ if (!dir_fd_converter(args[2], &src_dir_fd)) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ if (!dir_fd_converter(args[3], &dst_dir_fd)) {
+ goto exit;
+ }
+skip_optional_kwonly:
return_value = os_rename_impl(module, &src, &dst, src_dir_fd, dst_dir_fd);
exit:
@@ -1264,16 +1643,39 @@ os_replace(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *
{
PyObject *return_value = 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};
+ static _PyArg_Parser _parser = {NULL, _keywords, "replace", 0};
+ PyObject *argsbuf[4];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
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_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &src, path_converter, &dst, dir_fd_converter, &src_dir_fd, dir_fd_converter, &dst_dir_fd)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!path_converter(args[0], &src)) {
+ goto exit;
+ }
+ if (!path_converter(args[1], &dst)) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (args[2]) {
+ if (!dir_fd_converter(args[2], &src_dir_fd)) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ if (!dir_fd_converter(args[3], &dst_dir_fd)) {
+ goto exit;
+ }
+skip_optional_kwonly:
return_value = os_replace_impl(module, &src, &dst, src_dir_fd, dst_dir_fd);
exit:
@@ -1307,14 +1709,26 @@ os_rmdir(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", "dir_fd", NULL};
- static _PyArg_Parser _parser = {"O&|$O&:rmdir", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "rmdir", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
path_t path = PATH_T_INITIALIZE("rmdir", "path", 0, 0);
int dir_fd = DEFAULT_DIR_FD;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!path_converter(args[0], &path)) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (!UNLINKAT_DIR_FD_CONVERTER(args[1], &dir_fd)) {
+ goto exit;
+ }
+skip_optional_kwonly:
return_value = os_rmdir_impl(module, &path, dir_fd);
exit:
@@ -1382,12 +1796,16 @@ os_system(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *k
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"command", NULL};
- static _PyArg_Parser _parser = {"O&:system", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "system", 0};
+ PyObject *argsbuf[1];
PyObject *command = NULL;
long _return_value;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- PyUnicode_FSConverter, &command)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!PyUnicode_FSConverter(args[0], &command)) {
goto exit;
}
_return_value = os_system_impl(module, command);
@@ -1460,14 +1878,26 @@ os_unlink(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *k
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", "dir_fd", NULL};
- static _PyArg_Parser _parser = {"O&|$O&:unlink", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "unlink", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
path_t path = PATH_T_INITIALIZE("unlink", "path", 0, 0);
int dir_fd = DEFAULT_DIR_FD;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &path)) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (!UNLINKAT_DIR_FD_CONVERTER(args[1], &dir_fd)) {
goto exit;
}
+skip_optional_kwonly:
return_value = os_unlink_impl(module, &path, dir_fd);
exit:
@@ -1499,14 +1929,26 @@ os_remove(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *k
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", "dir_fd", NULL};
- static _PyArg_Parser _parser = {"O&|$O&:remove", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "remove", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
path_t path = PATH_T_INITIALIZE("remove", "path", 0, 0);
int dir_fd = DEFAULT_DIR_FD;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &path)) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (!UNLINKAT_DIR_FD_CONVERTER(args[1], &dir_fd)) {
goto exit;
}
+skip_optional_kwonly:
return_value = os_remove_impl(module, &path, dir_fd);
exit:
@@ -1582,17 +2024,54 @@ os_utime(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
{
PyObject *return_value = 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};
+ static _PyArg_Parser _parser = {NULL, _keywords, "utime", 0};
+ PyObject *argsbuf[5];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
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_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path, &times, &ns, FUTIMENSAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &path)) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[1]) {
+ times = args[1];
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+skip_optional_pos:
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (args[2]) {
+ ns = args[2];
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ if (args[3]) {
+ if (!FUTIMENSAT_DIR_FD_CONVERTER(args[3], &dir_fd)) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ follow_symlinks = PyObject_IsTrue(args[4]);
+ if (follow_symlinks < 0) {
+ goto exit;
+ }
+skip_optional_kwonly:
return_value = os_utime_impl(module, &path, times, ns, dir_fd, follow_symlinks);
exit:
@@ -1619,11 +2098,21 @@ os__exit(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"status", NULL};
- static _PyArg_Parser _parser = {"i:_exit", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "_exit", 0};
+ PyObject *argsbuf[1];
int status;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &status)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ status = _PyLong_AsInt(args[0]);
+ if (status == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = os__exit_impl(module, status);
@@ -1702,15 +2191,21 @@ os_execve(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *k
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", "argv", "env", NULL};
- static _PyArg_Parser _parser = {"O&OO:execve", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "execve", 0};
+ PyObject *argsbuf[3];
path_t path = PATH_T_INITIALIZE("execve", "path", 0, PATH_HAVE_FEXECVE);
PyObject *argv;
PyObject *env;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path, &argv, &env)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 3, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!path_converter(args[0], &path)) {
+ goto exit;
+ }
+ argv = args[1];
+ env = args[2];
return_value = os_execve_impl(module, &path, argv, env);
exit:
@@ -1768,7 +2263,9 @@ os_posix_spawn(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"", "", "", "file_actions", "setpgroup", "resetids", "setsid", "setsigmask", "setsigdef", "scheduler", NULL};
- static _PyArg_Parser _parser = {"O&OO|$OOiiOOO:posix_spawn", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "posix_spawn", 0};
+ PyObject *argsbuf[10];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 3;
path_t path = PATH_T_INITIALIZE("posix_spawn", "path", 0, 0);
PyObject *argv;
PyObject *env;
@@ -1780,10 +2277,72 @@ os_posix_spawn(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
PyObject *setsigdef = NULL;
PyObject *scheduler = NULL;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path, &argv, &env, &file_actions, &setpgroup, &resetids, &setsid, &setsigmask, &setsigdef, &scheduler)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 3, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &path)) {
goto exit;
}
+ argv = args[1];
+ env = args[2];
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (args[3]) {
+ file_actions = args[3];
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ if (args[4]) {
+ setpgroup = args[4];
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ if (args[5]) {
+ if (PyFloat_Check(args[5])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ resetids = _PyLong_AsInt(args[5]);
+ if (resetids == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ if (args[6]) {
+ if (PyFloat_Check(args[6])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ setsid = _PyLong_AsInt(args[6]);
+ if (setsid == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ if (args[7]) {
+ setsigmask = args[7];
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ if (args[8]) {
+ setsigdef = args[8];
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ scheduler = args[9];
+skip_optional_kwonly:
return_value = os_posix_spawn_impl(module, &path, argv, env, file_actions, setpgroup, resetids, setsid, setsigmask, setsigdef, scheduler);
exit:
@@ -1841,7 +2400,9 @@ os_posix_spawnp(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"", "", "", "file_actions", "setpgroup", "resetids", "setsid", "setsigmask", "setsigdef", "scheduler", NULL};
- static _PyArg_Parser _parser = {"O&OO|$OOiiOOO:posix_spawnp", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "posix_spawnp", 0};
+ PyObject *argsbuf[10];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 3;
path_t path = PATH_T_INITIALIZE("posix_spawnp", "path", 0, 0);
PyObject *argv;
PyObject *env;
@@ -1853,10 +2414,72 @@ os_posix_spawnp(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
PyObject *setsigdef = NULL;
PyObject *scheduler = NULL;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path, &argv, &env, &file_actions, &setpgroup, &resetids, &setsid, &setsigmask, &setsigdef, &scheduler)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 3, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &path)) {
goto exit;
}
+ argv = args[1];
+ env = args[2];
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (args[3]) {
+ file_actions = args[3];
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ if (args[4]) {
+ setpgroup = args[4];
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ if (args[5]) {
+ if (PyFloat_Check(args[5])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ resetids = _PyLong_AsInt(args[5]);
+ if (resetids == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ if (args[6]) {
+ if (PyFloat_Check(args[6])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ setsid = _PyLong_AsInt(args[6]);
+ if (setsid == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ if (args[7]) {
+ setsigmask = args[7];
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ if (args[8]) {
+ setsigdef = args[8];
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ scheduler = args[9];
+skip_optional_kwonly:
return_value = os_posix_spawnp_impl(module, &path, argv, env, file_actions, setpgroup, resetids, setsid, setsigmask, setsigdef, scheduler);
exit:
@@ -2016,15 +2639,34 @@ os_register_at_fork(PyObject *module, PyObject *const *args, Py_ssize_t nargs, P
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"before", "after_in_child", "after_in_parent", NULL};
- static _PyArg_Parser _parser = {"|$OOO:register_at_fork", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "register_at_fork", 0};
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *before = NULL;
PyObject *after_in_child = NULL;
PyObject *after_in_parent = NULL;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &before, &after_in_child, &after_in_parent)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 0, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (args[0]) {
+ before = args[0];
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ if (args[1]) {
+ after_in_child = args[1];
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ after_in_parent = args[2];
+skip_optional_kwonly:
return_value = os_register_at_fork_impl(module, before, after_in_child, after_in_parent);
exit:
@@ -2100,11 +2742,21 @@ os_sched_get_priority_max(PyObject *module, PyObject *const *args, Py_ssize_t na
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"policy", NULL};
- static _PyArg_Parser _parser = {"i:sched_get_priority_max", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "sched_get_priority_max", 0};
+ PyObject *argsbuf[1];
int policy;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &policy)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ policy = _PyLong_AsInt(args[0]);
+ if (policy == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = os_sched_get_priority_max_impl(module, policy);
@@ -2134,11 +2786,21 @@ os_sched_get_priority_min(PyObject *module, PyObject *const *args, Py_ssize_t na
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"policy", NULL};
- static _PyArg_Parser _parser = {"i:sched_get_priority_min", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "sched_get_priority_min", 0};
+ PyObject *argsbuf[1];
int policy;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &policy)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ policy = _PyLong_AsInt(args[0]);
+ if (policy == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = os_sched_get_priority_min_impl(module, policy);
@@ -2201,13 +2863,17 @@ os_sched_param(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"sched_priority", NULL};
- static _PyArg_Parser _parser = {"O:sched_param", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "sched_param", 0};
+ PyObject *argsbuf[1];
+ PyObject * const *fastargs;
+ Py_ssize_t nargs = PyTuple_GET_SIZE(args);
PyObject *sched_priority;
- if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
- &sched_priority)) {
+ fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 1, 0, argsbuf);
+ if (!fastargs) {
goto exit;
}
+ sched_priority = fastargs[0];
return_value = os_sched_param_impl(type, sched_priority);
exit:
@@ -3100,11 +3766,21 @@ os_wait3(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"options", NULL};
- static _PyArg_Parser _parser = {"i:wait3", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "wait3", 0};
+ PyObject *argsbuf[1];
int options;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &options)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ options = _PyLong_AsInt(args[0]);
+ if (options == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = os_wait3_impl(module, options);
@@ -3324,14 +4000,26 @@ os_readlink(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", "dir_fd", NULL};
- static _PyArg_Parser _parser = {"O&|$O&:readlink", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "readlink", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
path_t path = PATH_T_INITIALIZE("readlink", "path", 0, 0);
int dir_fd = DEFAULT_DIR_FD;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path, READLINKAT_DIR_FD_CONVERTER, &dir_fd)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &path)) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (!READLINKAT_DIR_FD_CONVERTER(args[1], &dir_fd)) {
+ goto exit;
+ }
+skip_optional_kwonly:
return_value = os_readlink_impl(module, &path, dir_fd);
exit:
@@ -3373,16 +4061,44 @@ os_symlink(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *
{
PyObject *return_value = 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};
+ static _PyArg_Parser _parser = {NULL, _keywords, "symlink", 0};
+ PyObject *argsbuf[4];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
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_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &src, path_converter, &dst, &target_is_directory, SYMLINKAT_DIR_FD_CONVERTER, &dir_fd)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &src)) {
+ goto exit;
+ }
+ if (!path_converter(args[1], &dst)) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[2]) {
+ target_is_directory = PyObject_IsTrue(args[2]);
+ if (target_is_directory < 0) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+skip_optional_pos:
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (!SYMLINKAT_DIR_FD_CONVERTER(args[3], &dir_fd)) {
goto exit;
}
+skip_optional_kwonly:
return_value = os_symlink_impl(module, &src, &dst, target_is_directory, dir_fd);
exit:
@@ -3600,17 +4316,56 @@ os_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwn
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", "flags", "mode", "dir_fd", NULL};
- static _PyArg_Parser _parser = {"O&i|i$O&:open", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "open", 0};
+ PyObject *argsbuf[4];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
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_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path, &flags, &mode, OPENAT_DIR_FD_CONVERTER, &dir_fd)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &path)) {
goto exit;
}
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ flags = _PyLong_AsInt(args[1]);
+ if (flags == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[2]) {
+ if (PyFloat_Check(args[2])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ mode = _PyLong_AsInt(args[2]);
+ if (mode == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+skip_optional_pos:
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (!OPENAT_DIR_FD_CONVERTER(args[3], &dir_fd)) {
+ goto exit;
+ }
+skip_optional_kwonly:
_return_value = os_open_impl(module, &path, flags, mode, dir_fd);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
@@ -3641,11 +4396,21 @@ os_close(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"fd", NULL};
- static _PyArg_Parser _parser = {"i:close", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "close", 0};
+ PyObject *argsbuf[1];
int fd;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &fd)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ fd = _PyLong_AsInt(args[0]);
+ if (fd == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = os_close_impl(module, fd);
@@ -3755,16 +4520,44 @@ os_dup2(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwn
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"fd", "fd2", "inheritable", NULL};
- static _PyArg_Parser _parser = {"ii|p:dup2", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "dup2", 0};
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
int fd;
int fd2;
int inheritable = 1;
int _return_value;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &fd, &fd2, &inheritable)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
goto exit;
}
+ fd = _PyLong_AsInt(args[0]);
+ if (fd == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ fd2 = _PyLong_AsInt(args[1]);
+ if (fd2 == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ inheritable = PyObject_IsTrue(args[2]);
+ if (inheritable < 0) {
+ goto exit;
+ }
+skip_optional_pos:
_return_value = os_dup2_impl(module, fd, fd2, inheritable);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
@@ -4274,11 +5067,21 @@ os_fstat(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"fd", NULL};
- static _PyArg_Parser _parser = {"i:fstat", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "fstat", 0};
+ PyObject *argsbuf[1];
int fd;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &fd)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ fd = _PyLong_AsInt(args[0]);
+ if (fd == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = os_fstat_impl(module, fd);
@@ -4616,15 +5419,45 @@ os_mkfifo(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *k
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", "mode", "dir_fd", NULL};
- static _PyArg_Parser _parser = {"O&|i$O&:mkfifo", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "mkfifo", 0};
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
path_t path = PATH_T_INITIALIZE("mkfifo", "path", 0, 0);
int mode = 438;
int dir_fd = DEFAULT_DIR_FD;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path, &mode, MKFIFOAT_DIR_FD_CONVERTER, &dir_fd)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &path)) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[1]) {
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ mode = _PyLong_AsInt(args[1]);
+ if (mode == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+skip_optional_pos:
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (!MKFIFOAT_DIR_FD_CONVERTER(args[2], &dir_fd)) {
goto exit;
}
+skip_optional_kwonly:
return_value = os_mkfifo_impl(module, &path, mode, dir_fd);
exit:
@@ -4668,16 +5501,54 @@ os_mknod(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", "mode", "device", "dir_fd", NULL};
- static _PyArg_Parser _parser = {"O&|iO&$O&:mknod", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "mknod", 0};
+ PyObject *argsbuf[4];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
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_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path, &mode, _Py_Dev_Converter, &device, MKNODAT_DIR_FD_CONVERTER, &dir_fd)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &path)) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[1]) {
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ mode = _PyLong_AsInt(args[1]);
+ if (mode == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ if (args[2]) {
+ if (!_Py_Dev_Converter(args[2], &device)) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+skip_optional_pos:
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (!MKNODAT_DIR_FD_CONVERTER(args[3], &dir_fd)) {
+ goto exit;
+ }
+skip_optional_kwonly:
return_value = os_mknod_impl(module, &path, mode, device, dir_fd);
exit:
@@ -4882,12 +5753,19 @@ os_truncate(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", "length", NULL};
- static _PyArg_Parser _parser = {"O&O&:truncate", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "truncate", 0};
+ PyObject *argsbuf[2];
path_t path = PATH_T_INITIALIZE("truncate", "path", 0, PATH_HAVE_FTRUNCATE);
Py_off_t length;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path, Py_off_t_converter, &length)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &path)) {
+ goto exit;
+ }
+ if (!Py_off_t_converter(args[1], &length)) {
goto exit;
}
return_value = os_truncate_impl(module, &path, length);
@@ -5242,12 +6120,22 @@ os_WIFCONTINUED(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"status", NULL};
- static _PyArg_Parser _parser = {"i:WIFCONTINUED", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "WIFCONTINUED", 0};
+ PyObject *argsbuf[1];
int status;
int _return_value;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &status)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ status = _PyLong_AsInt(args[0]);
+ if (status == -1 && PyErr_Occurred()) {
goto exit;
}
_return_value = os_WIFCONTINUED_impl(module, status);
@@ -5281,12 +6169,22 @@ os_WIFSTOPPED(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"status", NULL};
- static _PyArg_Parser _parser = {"i:WIFSTOPPED", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "WIFSTOPPED", 0};
+ PyObject *argsbuf[1];
int status;
int _return_value;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &status)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ status = _PyLong_AsInt(args[0]);
+ if (status == -1 && PyErr_Occurred()) {
goto exit;
}
_return_value = os_WIFSTOPPED_impl(module, status);
@@ -5320,12 +6218,22 @@ os_WIFSIGNALED(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"status", NULL};
- static _PyArg_Parser _parser = {"i:WIFSIGNALED", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "WIFSIGNALED", 0};
+ PyObject *argsbuf[1];
int status;
int _return_value;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &status)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ status = _PyLong_AsInt(args[0]);
+ if (status == -1 && PyErr_Occurred()) {
goto exit;
}
_return_value = os_WIFSIGNALED_impl(module, status);
@@ -5359,12 +6267,22 @@ os_WIFEXITED(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"status", NULL};
- static _PyArg_Parser _parser = {"i:WIFEXITED", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "WIFEXITED", 0};
+ PyObject *argsbuf[1];
int status;
int _return_value;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &status)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ status = _PyLong_AsInt(args[0]);
+ if (status == -1 && PyErr_Occurred()) {
goto exit;
}
_return_value = os_WIFEXITED_impl(module, status);
@@ -5398,12 +6316,22 @@ os_WEXITSTATUS(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"status", NULL};
- static _PyArg_Parser _parser = {"i:WEXITSTATUS", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "WEXITSTATUS", 0};
+ PyObject *argsbuf[1];
int status;
int _return_value;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &status)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ status = _PyLong_AsInt(args[0]);
+ if (status == -1 && PyErr_Occurred()) {
goto exit;
}
_return_value = os_WEXITSTATUS_impl(module, status);
@@ -5437,12 +6365,22 @@ os_WTERMSIG(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"status", NULL};
- static _PyArg_Parser _parser = {"i:WTERMSIG", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "WTERMSIG", 0};
+ PyObject *argsbuf[1];
int status;
int _return_value;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &status)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ status = _PyLong_AsInt(args[0]);
+ if (status == -1 && PyErr_Occurred()) {
goto exit;
}
_return_value = os_WTERMSIG_impl(module, status);
@@ -5476,12 +6414,22 @@ os_WSTOPSIG(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"status", NULL};
- static _PyArg_Parser _parser = {"i:WSTOPSIG", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "WSTOPSIG", 0};
+ PyObject *argsbuf[1];
int status;
int _return_value;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &status)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ status = _PyLong_AsInt(args[0]);
+ if (status == -1 && PyErr_Occurred()) {
goto exit;
}
_return_value = os_WSTOPSIG_impl(module, status);
@@ -5558,11 +6506,15 @@ os_statvfs(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", NULL};
- static _PyArg_Parser _parser = {"O&:statvfs", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "statvfs", 0};
+ PyObject *argsbuf[1];
path_t path = PATH_T_INITIALIZE("statvfs", "path", 0, PATH_HAVE_FSTATVFS);
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &path)) {
goto exit;
}
return_value = os_statvfs_impl(module, &path);
@@ -5595,11 +6547,15 @@ os__getdiskusage(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", NULL};
- static _PyArg_Parser _parser = {"O&:_getdiskusage", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "_getdiskusage", 0};
+ PyObject *argsbuf[1];
path_t path = PATH_T_INITIALIZE("_getdiskusage", "path", 0, 0);
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &path)) {
goto exit;
}
return_value = os__getdiskusage_impl(module, &path);
@@ -5687,13 +6643,20 @@ os_pathconf(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", "name", NULL};
- static _PyArg_Parser _parser = {"O&O&:pathconf", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "pathconf", 0};
+ PyObject *argsbuf[2];
path_t path = PATH_T_INITIALIZE("pathconf", "path", 0, PATH_HAVE_FPATHCONF);
int name;
long _return_value;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path, conv_path_confname, &name)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &path)) {
+ goto exit;
+ }
+ if (!conv_path_confname(args[1], &name)) {
goto exit;
}
_return_value = os_pathconf_impl(module, &path, name);
@@ -5901,11 +6864,21 @@ os_device_encoding(PyObject *module, PyObject *const *args, Py_ssize_t nargs, Py
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"fd", NULL};
- static _PyArg_Parser _parser = {"i:device_encoding", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "device_encoding", 0};
+ PyObject *argsbuf[1];
int fd;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &fd)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ fd = _PyLong_AsInt(args[0]);
+ if (fd == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = os_device_encoding_impl(module, fd);
@@ -6067,15 +7040,31 @@ os_getxattr(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", "attribute", "follow_symlinks", NULL};
- static _PyArg_Parser _parser = {"O&O&|$p:getxattr", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "getxattr", 0};
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
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_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path, path_converter, &attribute, &follow_symlinks)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!path_converter(args[0], &path)) {
+ goto exit;
+ }
+ if (!path_converter(args[1], &attribute)) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ follow_symlinks = PyObject_IsTrue(args[2]);
+ if (follow_symlinks < 0) {
+ goto exit;
+ }
+skip_optional_kwonly:
return_value = os_getxattr_impl(module, &path, &attribute, follow_symlinks);
exit:
@@ -6115,17 +7104,58 @@ os_setxattr(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = 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};
+ static _PyArg_Parser _parser = {NULL, _keywords, "setxattr", 0};
+ PyObject *argsbuf[5];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 3;
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_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path, path_converter, &attribute, &value, &flags, &follow_symlinks)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 4, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &path)) {
+ goto exit;
+ }
+ if (!path_converter(args[1], &attribute)) {
+ goto exit;
+ }
+ if (PyObject_GetBuffer(args[2], &value, PyBUF_SIMPLE) != 0) {
+ goto exit;
+ }
+ if (!PyBuffer_IsContiguous(&value, 'C')) {
+ _PyArg_BadArgument("setxattr", 3, "contiguous buffer", args[2]);
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[3]) {
+ if (PyFloat_Check(args[3])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ flags = _PyLong_AsInt(args[3]);
+ if (flags == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+skip_optional_pos:
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ follow_symlinks = PyObject_IsTrue(args[4]);
+ if (follow_symlinks < 0) {
+ goto exit;
+ }
+skip_optional_kwonly:
return_value = os_setxattr_impl(module, &path, &attribute, &value, flags, follow_symlinks);
exit:
@@ -6168,15 +7198,31 @@ os_removexattr(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", "attribute", "follow_symlinks", NULL};
- static _PyArg_Parser _parser = {"O&O&|$p:removexattr", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "removexattr", 0};
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
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_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path, path_converter, &attribute, &follow_symlinks)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &path)) {
+ goto exit;
+ }
+ if (!path_converter(args[1], &attribute)) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ follow_symlinks = PyObject_IsTrue(args[2]);
+ if (follow_symlinks < 0) {
goto exit;
}
+skip_optional_kwonly:
return_value = os_removexattr_impl(module, &path, &attribute, follow_symlinks);
exit:
@@ -6215,14 +7261,36 @@ os_listxattr(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", "follow_symlinks", NULL};
- static _PyArg_Parser _parser = {"|O&$p:listxattr", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "listxattr", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
path_t path = PATH_T_INITIALIZE("listxattr", "path", 1, 1);
int follow_symlinks = 1;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path, &follow_symlinks)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[0]) {
+ if (!path_converter(args[0], &path)) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+skip_optional_pos:
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ follow_symlinks = PyObject_IsTrue(args[1]);
+ if (follow_symlinks < 0) {
goto exit;
}
+skip_optional_kwonly:
return_value = os_listxattr_impl(module, &path, follow_symlinks);
exit:
@@ -6593,13 +7661,23 @@ os_DirEntry_stat(DirEntry *self, PyObject *const *args, Py_ssize_t nargs, PyObje
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"follow_symlinks", NULL};
- static _PyArg_Parser _parser = {"|$p:stat", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "stat", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
int follow_symlinks = 1;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &follow_symlinks)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 0, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ follow_symlinks = PyObject_IsTrue(args[0]);
+ if (follow_symlinks < 0) {
+ goto exit;
+ }
+skip_optional_kwonly:
return_value = os_DirEntry_stat_impl(self, follow_symlinks);
exit:
@@ -6623,14 +7701,24 @@ os_DirEntry_is_dir(DirEntry *self, PyObject *const *args, Py_ssize_t nargs, PyOb
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"follow_symlinks", NULL};
- static _PyArg_Parser _parser = {"|$p:is_dir", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "is_dir", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
int follow_symlinks = 1;
int _return_value;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &follow_symlinks)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 0, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ follow_symlinks = PyObject_IsTrue(args[0]);
+ if (follow_symlinks < 0) {
+ goto exit;
+ }
+skip_optional_kwonly:
_return_value = os_DirEntry_is_dir_impl(self, follow_symlinks);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
@@ -6658,14 +7746,24 @@ os_DirEntry_is_file(DirEntry *self, PyObject *const *args, Py_ssize_t nargs, PyO
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"follow_symlinks", NULL};
- static _PyArg_Parser _parser = {"|$p:is_file", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "is_file", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
int follow_symlinks = 1;
int _return_value;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &follow_symlinks)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 0, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ follow_symlinks = PyObject_IsTrue(args[0]);
+ if (follow_symlinks < 0) {
goto exit;
}
+skip_optional_kwonly:
_return_value = os_DirEntry_is_file_impl(self, follow_symlinks);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
@@ -6735,13 +7833,22 @@ os_scandir(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", NULL};
- static _PyArg_Parser _parser = {"|O&:scandir", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "scandir", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
path_t path = PATH_T_INITIALIZE("scandir", "path", 1, PATH_HAVE_FDOPENDIR);
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &path)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (!path_converter(args[0], &path)) {
goto exit;
}
+skip_optional_pos:
return_value = os_scandir_impl(module, &path);
exit:
@@ -6772,13 +7879,15 @@ os_fspath(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *k
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", NULL};
- static _PyArg_Parser _parser = {"O:fspath", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "fspath", 0};
+ PyObject *argsbuf[1];
PyObject *path;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &path)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ path = args[0];
return_value = os_fspath_impl(module, path);
exit:
@@ -6804,14 +7913,46 @@ os_getrandom(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"size", "flags", NULL};
- static _PyArg_Parser _parser = {"n|i:getrandom", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "getrandom", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
Py_ssize_t size;
int flags = 0;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &size, &flags)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ {
+ Py_ssize_t ival = -1;
+ PyObject *iobj = PyNumber_Index(args[0]);
+ if (iobj != NULL) {
+ ival = PyLong_AsSsize_t(iobj);
+ Py_DECREF(iobj);
+ }
+ if (ival == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ size = ival;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ flags = _PyLong_AsInt(args[1]);
+ if (flags == -1 && PyErr_Occurred()) {
goto exit;
}
+skip_optional_pos:
return_value = os_getrandom_impl(module, size, flags);
exit:
@@ -7339,4 +8480,4 @@ exit:
#ifndef OS_GETRANDOM_METHODDEF
#define OS_GETRANDOM_METHODDEF
#endif /* !defined(OS_GETRANDOM_METHODDEF) */
-/*[clinic end generated code: output=bb677205c036deca input=a9049054013a1b77]*/
+/*[clinic end generated code: output=1a9c62f5841221ae input=a9049054013a1b77]*/
diff --git a/Modules/clinic/pyexpat.c.h b/Modules/clinic/pyexpat.c.h
index 3fe7b64..dfb27d5 100644
--- a/Modules/clinic/pyexpat.c.h
+++ b/Modules/clinic/pyexpat.c.h
@@ -297,15 +297,68 @@ pyexpat_ParserCreate(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"encoding", "namespace_separator", "intern", NULL};
- static _PyArg_Parser _parser = {"|zzO:ParserCreate", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "ParserCreate", 0};
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
const char *encoding = NULL;
const char *namespace_separator = NULL;
PyObject *intern = NULL;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &encoding, &namespace_separator, &intern)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 3, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[0]) {
+ if (args[0] == Py_None) {
+ encoding = NULL;
+ }
+ else if (PyUnicode_Check(args[0])) {
+ Py_ssize_t encoding_length;
+ encoding = PyUnicode_AsUTF8AndSize(args[0], &encoding_length);
+ if (encoding == NULL) {
+ goto exit;
+ }
+ if (strlen(encoding) != (size_t)encoding_length) {
+ PyErr_SetString(PyExc_ValueError, "embedded null character");
+ goto exit;
+ }
+ }
+ else {
+ _PyArg_BadArgument("ParserCreate", 1, "str or None", args[0]);
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ if (args[1]) {
+ if (args[1] == Py_None) {
+ namespace_separator = NULL;
+ }
+ else if (PyUnicode_Check(args[1])) {
+ Py_ssize_t namespace_separator_length;
+ namespace_separator = PyUnicode_AsUTF8AndSize(args[1], &namespace_separator_length);
+ if (namespace_separator == NULL) {
+ goto exit;
+ }
+ if (strlen(namespace_separator) != (size_t)namespace_separator_length) {
+ PyErr_SetString(PyExc_ValueError, "embedded null character");
+ goto exit;
+ }
+ }
+ else {
+ _PyArg_BadArgument("ParserCreate", 2, "str or None", args[1]);
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ intern = args[2];
+skip_optional_pos:
return_value = pyexpat_ParserCreate_impl(module, encoding, namespace_separator, intern);
exit:
@@ -348,4 +401,4 @@ exit:
#ifndef PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
#define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
#endif /* !defined(PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF) */
-/*[clinic end generated code: output=0f18b756d82b78a5 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=e48f37d326956bdd input=a9049054013a1b77]*/
diff --git a/Modules/clinic/selectmodule.c.h b/Modules/clinic/selectmodule.c.h
index c2ef26f..9015816 100644
--- a/Modules/clinic/selectmodule.c.h
+++ b/Modules/clinic/selectmodule.c.h
@@ -512,14 +512,45 @@ select_epoll(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"sizehint", "flags", NULL};
- static _PyArg_Parser _parser = {"|ii:epoll", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "epoll", 0};
+ PyObject *argsbuf[2];
+ PyObject * const *fastargs;
+ Py_ssize_t nargs = PyTuple_GET_SIZE(args);
+ Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0;
int sizehint = -1;
int flags = 0;
- if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
- &sizehint, &flags)) {
+ fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 2, 0, argsbuf);
+ if (!fastargs) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (fastargs[0]) {
+ if (PyFloat_Check(fastargs[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ sizehint = _PyLong_AsInt(fastargs[0]);
+ if (sizehint == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ if (PyFloat_Check(fastargs[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ flags = _PyLong_AsInt(fastargs[1]);
+ if (flags == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+skip_optional_pos:
return_value = select_epoll_impl(type, sizehint, flags);
exit:
@@ -638,14 +669,32 @@ select_epoll_register(pyEpoll_Object *self, PyObject *const *args, Py_ssize_t na
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"fd", "eventmask", NULL};
- static _PyArg_Parser _parser = {"O&|I:register", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "register", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
int fd;
unsigned int eventmask = EPOLLIN | EPOLLPRI | EPOLLOUT;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- fildes_converter, &fd, &eventmask)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!fildes_converter(args[0], &fd)) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ eventmask = (unsigned int)PyLong_AsUnsignedLongMask(args[1]);
+ if (eventmask == (unsigned int)-1 && PyErr_Occurred()) {
+ goto exit;
+ }
+skip_optional_pos:
return_value = select_epoll_register_impl(self, fd, eventmask);
exit:
@@ -679,12 +728,25 @@ select_epoll_modify(pyEpoll_Object *self, PyObject *const *args, Py_ssize_t narg
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"fd", "eventmask", NULL};
- static _PyArg_Parser _parser = {"O&I:modify", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "modify", 0};
+ PyObject *argsbuf[2];
int fd;
unsigned int eventmask;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- fildes_converter, &fd, &eventmask)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!fildes_converter(args[0], &fd)) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ eventmask = (unsigned int)PyLong_AsUnsignedLongMask(args[1]);
+ if (eventmask == (unsigned int)-1 && PyErr_Occurred()) {
goto exit;
}
return_value = select_epoll_modify_impl(self, fd, eventmask);
@@ -717,11 +779,15 @@ select_epoll_unregister(pyEpoll_Object *self, PyObject *const *args, Py_ssize_t
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"fd", NULL};
- static _PyArg_Parser _parser = {"O&:unregister", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "unregister", 0};
+ PyObject *argsbuf[1];
int fd;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- fildes_converter, &fd)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!fildes_converter(args[0], &fd)) {
goto exit;
}
return_value = select_epoll_unregister_impl(self, fd);
@@ -761,14 +827,35 @@ select_epoll_poll(pyEpoll_Object *self, PyObject *const *args, Py_ssize_t nargs,
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"timeout", "maxevents", NULL};
- static _PyArg_Parser _parser = {"|Oi:poll", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "poll", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *timeout_obj = Py_None;
int maxevents = -1;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &timeout_obj, &maxevents)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 2, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[0]) {
+ timeout_obj = args[0];
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ maxevents = _PyLong_AsInt(args[1]);
+ if (maxevents == -1 && PyErr_Occurred()) {
goto exit;
}
+skip_optional_pos:
return_value = select_epoll_poll_impl(self, timeout_obj, maxevents);
exit:
@@ -1128,4 +1215,4 @@ exit:
#ifndef SELECT_KQUEUE_CONTROL_METHODDEF
#define SELECT_KQUEUE_CONTROL_METHODDEF
#endif /* !defined(SELECT_KQUEUE_CONTROL_METHODDEF) */
-/*[clinic end generated code: output=3e40b33a3294d03d input=a9049054013a1b77]*/
+/*[clinic end generated code: output=03041f3d09b04a3d input=a9049054013a1b77]*/
diff --git a/Modules/clinic/sha1module.c.h b/Modules/clinic/sha1module.c.h
index af29173..001c6af 100644
--- a/Modules/clinic/sha1module.c.h
+++ b/Modules/clinic/sha1module.c.h
@@ -82,16 +82,23 @@ _sha1_sha1(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", NULL};
- static _PyArg_Parser _parser = {"|O:sha1", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "sha1", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *string = NULL;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &string)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ string = args[0];
+skip_optional_pos:
return_value = _sha1_sha1_impl(module, string);
exit:
return return_value;
}
-/*[clinic end generated code: output=3bae85313ee5a3b5 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=1ae7e73ec84a27d5 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/sha256module.c.h b/Modules/clinic/sha256module.c.h
index 14a88a2..658abb1 100644
--- a/Modules/clinic/sha256module.c.h
+++ b/Modules/clinic/sha256module.c.h
@@ -82,13 +82,20 @@ _sha256_sha256(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", NULL};
- static _PyArg_Parser _parser = {"|O:sha256", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "sha256", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *string = NULL;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &string)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ string = args[0];
+skip_optional_pos:
return_value = _sha256_sha256_impl(module, string);
exit:
@@ -112,16 +119,23 @@ _sha256_sha224(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", NULL};
- static _PyArg_Parser _parser = {"|O:sha224", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "sha224", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *string = NULL;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &string)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ string = args[0];
+skip_optional_pos:
return_value = _sha256_sha224_impl(module, string);
exit:
return return_value;
}
-/*[clinic end generated code: output=fb208641d4bc3b5f input=a9049054013a1b77]*/
+/*[clinic end generated code: output=c54d0956ec88409d input=a9049054013a1b77]*/
diff --git a/Modules/clinic/sha512module.c.h b/Modules/clinic/sha512module.c.h
index 7e08701..459a934 100644
--- a/Modules/clinic/sha512module.c.h
+++ b/Modules/clinic/sha512module.c.h
@@ -82,13 +82,20 @@ _sha512_sha512(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", NULL};
- static _PyArg_Parser _parser = {"|O:sha512", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "sha512", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *string = NULL;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &string)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ string = args[0];
+skip_optional_pos:
return_value = _sha512_sha512_impl(module, string);
exit:
@@ -112,16 +119,23 @@ _sha512_sha384(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", NULL};
- static _PyArg_Parser _parser = {"|O:sha384", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "sha384", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *string = NULL;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &string)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ string = args[0];
+skip_optional_pos:
return_value = _sha512_sha384_impl(module, string);
exit:
return return_value;
}
-/*[clinic end generated code: output=3706fa47bea06c0b input=a9049054013a1b77]*/
+/*[clinic end generated code: output=580df4b667084a7e input=a9049054013a1b77]*/
diff --git a/Modules/clinic/zlibmodule.c.h b/Modules/clinic/zlibmodule.c.h
index 8e5f96a..aa57920 100644
--- a/Modules/clinic/zlibmodule.c.h
+++ b/Modules/clinic/zlibmodule.c.h
@@ -24,14 +24,36 @@ zlib_compress(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"", "level", NULL};
- static _PyArg_Parser _parser = {"y*|i:compress", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "compress", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
Py_buffer data = {NULL, NULL};
int level = Z_DEFAULT_COMPRESSION;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &data, &level)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
+ goto exit;
+ }
+ if (!PyBuffer_IsContiguous(&data, 'C')) {
+ _PyArg_BadArgument("compress", 1, "contiguous buffer", args[0]);
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ level = _PyLong_AsInt(args[1]);
+ if (level == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+skip_optional_pos:
return_value = zlib_compress_impl(module, &data, level);
exit:
@@ -68,15 +90,45 @@ zlib_decompress(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"", "wbits", "bufsize", NULL};
- static _PyArg_Parser _parser = {"y*|iO&:decompress", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "decompress", 0};
+ PyObject *argsbuf[3];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
Py_buffer data = {NULL, NULL};
int wbits = MAX_WBITS;
Py_ssize_t bufsize = DEF_BUF_SIZE;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &data, &wbits, ssize_t_converter, &bufsize)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
+ goto exit;
+ }
+ if (!PyBuffer_IsContiguous(&data, 'C')) {
+ _PyArg_BadArgument("decompress", 1, "contiguous buffer", args[0]);
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[1]) {
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ wbits = _PyLong_AsInt(args[1]);
+ if (wbits == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ if (!ssize_t_converter(args[2], &bufsize)) {
+ goto exit;
+ }
+skip_optional_pos:
return_value = zlib_decompress_impl(module, &data, wbits, bufsize);
exit:
@@ -130,7 +182,9 @@ zlib_compressobj(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"level", "method", "wbits", "memLevel", "strategy", "zdict", NULL};
- static _PyArg_Parser _parser = {"|iiiiiy*:compressobj", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "compressobj", 0};
+ PyObject *argsbuf[6];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
int level = Z_DEFAULT_COMPRESSION;
int method = DEFLATED;
int wbits = MAX_WBITS;
@@ -138,10 +192,91 @@ zlib_compressobj(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
int strategy = Z_DEFAULT_STRATEGY;
Py_buffer zdict = {NULL, NULL};
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &level, &method, &wbits, &memLevel, &strategy, &zdict)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 6, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[0]) {
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ level = _PyLong_AsInt(args[0]);
+ if (level == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ if (args[1]) {
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ method = _PyLong_AsInt(args[1]);
+ if (method == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ if (args[2]) {
+ if (PyFloat_Check(args[2])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ wbits = _PyLong_AsInt(args[2]);
+ if (wbits == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ if (args[3]) {
+ if (PyFloat_Check(args[3])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ memLevel = _PyLong_AsInt(args[3]);
+ if (memLevel == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ if (args[4]) {
+ if (PyFloat_Check(args[4])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ strategy = _PyLong_AsInt(args[4]);
+ if (strategy == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ if (PyObject_GetBuffer(args[5], &zdict, PyBUF_SIMPLE) != 0) {
+ goto exit;
+ }
+ if (!PyBuffer_IsContiguous(&zdict, 'C')) {
+ _PyArg_BadArgument("compressobj", 6, "contiguous buffer", args[5]);
+ goto exit;
+ }
+skip_optional_pos:
return_value = zlib_compressobj_impl(module, level, method, wbits, memLevel, strategy, &zdict);
exit:
@@ -176,14 +311,35 @@ zlib_decompressobj(PyObject *module, PyObject *const *args, Py_ssize_t nargs, Py
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"wbits", "zdict", NULL};
- static _PyArg_Parser _parser = {"|iO:decompressobj", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "decompressobj", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
int wbits = MAX_WBITS;
PyObject *zdict = NULL;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &wbits, &zdict)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 2, 0, argsbuf);
+ if (!args) {
goto exit;
}
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[0]) {
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ wbits = _PyLong_AsInt(args[0]);
+ if (wbits == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ zdict = args[1];
+skip_optional_pos:
return_value = zlib_decompressobj_impl(module, wbits, zdict);
exit:
@@ -262,14 +418,30 @@ zlib_Decompress_decompress(compobject *self, PyObject *const *args, Py_ssize_t n
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"", "max_length", NULL};
- static _PyArg_Parser _parser = {"y*|O&:decompress", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "decompress", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
Py_buffer data = {NULL, NULL};
Py_ssize_t max_length = 0;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &data, ssize_t_converter, &max_length)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
+ goto exit;
+ }
+ if (!PyBuffer_IsContiguous(&data, 'C')) {
+ _PyArg_BadArgument("decompress", 1, "contiguous buffer", args[0]);
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (!ssize_t_converter(args[1], &max_length)) {
goto exit;
}
+skip_optional_pos:
return_value = zlib_Decompress_decompress_impl(self, &data, max_length);
exit:
@@ -613,4 +785,4 @@ exit:
#ifndef ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF
#define ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF
#endif /* !defined(ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF) */
-/*[clinic end generated code: output=b3acec2384f18782 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=feb079cebbbaacd6 input=a9049054013a1b77]*/