summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2019-01-11 16:01:42 (GMT)
committerGitHub <noreply@github.com>2019-01-11 16:01:42 (GMT)
commit2a39d251f07d4c620e3b9a1848e3d1eb3067be64 (patch)
tree23c1e8e63e57945fab6127d31800b7578795e14b /Modules
parent4fa9591025b6a098f3d6402e5413ee6740ede6c5 (diff)
downloadcpython-2a39d251f07d4c620e3b9a1848e3d1eb3067be64.zip
cpython-2a39d251f07d4c620e3b9a1848e3d1eb3067be64.tar.gz
cpython-2a39d251f07d4c620e3b9a1848e3d1eb3067be64.tar.bz2
bpo-35582: Argument Clinic: Optimize the "all boring objects" case. (GH-11520)
Use _PyArg_CheckPositional() and inlined code instead of PyArg_UnpackTuple() and _PyArg_UnpackStack() if all parameters are positional and use the "object" converter.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_io/clinic/bufferedio.c.h11
-rw-r--r--Modules/_io/clinic/bytesio.c.h11
-rw-r--r--Modules/_io/clinic/fileio.c.h11
-rw-r--r--Modules/_io/clinic/textio.c.h11
-rw-r--r--Modules/cjkcodecs/clinic/multibytecodec.c.h29
-rw-r--r--Modules/clinic/_abc.c.h20
-rw-r--r--Modules/clinic/_cursesmodule.c.h39
-rw-r--r--Modules/clinic/_elementtree.c.h34
-rw-r--r--Modules/clinic/_gdbmmodule.c.h22
-rw-r--r--Modules/clinic/_heapqmodule.c.h26
-rw-r--r--Modules/clinic/_operator.c.h261
-rw-r--r--Modules/clinic/_pickle.c.h8
-rw-r--r--Modules/clinic/_sre.c.h29
-rw-r--r--Modules/clinic/itertoolsmodule.c.h36
-rw-r--r--Modules/clinic/mathmodule.c.h14
-rw-r--r--Modules/clinic/selectmodule.c.h49
16 files changed, 355 insertions, 256 deletions
diff --git a/Modules/_io/clinic/bufferedio.c.h b/Modules/_io/clinic/bufferedio.c.h
index 6345b9e..60a6dac 100644
--- a/Modules/_io/clinic/bufferedio.c.h
+++ b/Modules/_io/clinic/bufferedio.c.h
@@ -389,11 +389,14 @@ _io__Buffered_truncate(buffered *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *return_value = NULL;
PyObject *pos = Py_None;
- if (!_PyArg_UnpackStack(args, nargs, "truncate",
- 0, 1,
- &pos)) {
+ if (!_PyArg_CheckPositional("truncate", nargs, 0, 1)) {
goto exit;
}
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ pos = args[0];
+skip_optional:
return_value = _io__Buffered_truncate_impl(self, pos);
exit:
@@ -591,4 +594,4 @@ _io_BufferedRandom___init__(PyObject *self, PyObject *args, PyObject *kwargs)
exit:
return return_value;
}
-/*[clinic end generated code: output=a85f61f495feff5c input=a9049054013a1b77]*/
+/*[clinic end generated code: output=b7f51040defff318 input=a9049054013a1b77]*/
diff --git a/Modules/_io/clinic/bytesio.c.h b/Modules/_io/clinic/bytesio.c.h
index 5588416..54c5123 100644
--- a/Modules/_io/clinic/bytesio.c.h
+++ b/Modules/_io/clinic/bytesio.c.h
@@ -282,11 +282,14 @@ _io_BytesIO_readlines(bytesio *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *return_value = NULL;
PyObject *arg = Py_None;
- if (!_PyArg_UnpackStack(args, nargs, "readlines",
- 0, 1,
- &arg)) {
+ if (!_PyArg_CheckPositional("readlines", nargs, 0, 1)) {
goto exit;
}
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ arg = args[0];
+skip_optional:
return_value = _io_BytesIO_readlines_impl(self, arg);
exit:
@@ -503,4 +506,4 @@ _io_BytesIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
exit:
return return_value;
}
-/*[clinic end generated code: output=5c68eb481fa960bf input=a9049054013a1b77]*/
+/*[clinic end generated code: output=a6b47dd7921abfcd input=a9049054013a1b77]*/
diff --git a/Modules/_io/clinic/fileio.c.h b/Modules/_io/clinic/fileio.c.h
index 280549e..e7d49d4 100644
--- a/Modules/_io/clinic/fileio.c.h
+++ b/Modules/_io/clinic/fileio.c.h
@@ -368,11 +368,14 @@ _io_FileIO_truncate(fileio *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *return_value = NULL;
PyObject *posobj = NULL;
- if (!_PyArg_UnpackStack(args, nargs, "truncate",
- 0, 1,
- &posobj)) {
+ if (!_PyArg_CheckPositional("truncate", nargs, 0, 1)) {
goto exit;
}
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ posobj = args[0];
+skip_optional:
return_value = _io_FileIO_truncate_impl(self, posobj);
exit:
@@ -402,4 +405,4 @@ _io_FileIO_isatty(fileio *self, PyObject *Py_UNUSED(ignored))
#ifndef _IO_FILEIO_TRUNCATE_METHODDEF
#define _IO_FILEIO_TRUNCATE_METHODDEF
#endif /* !defined(_IO_FILEIO_TRUNCATE_METHODDEF) */
-/*[clinic end generated code: output=4cf4e5f0cd656b11 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=b6f327457938d4dd input=a9049054013a1b77]*/
diff --git a/Modules/_io/clinic/textio.c.h b/Modules/_io/clinic/textio.c.h
index 0ff0324..2a13abf 100644
--- a/Modules/_io/clinic/textio.c.h
+++ b/Modules/_io/clinic/textio.c.h
@@ -419,11 +419,14 @@ _io_TextIOWrapper_truncate(textio *self, PyObject *const *args, Py_ssize_t nargs
PyObject *return_value = NULL;
PyObject *pos = Py_None;
- if (!_PyArg_UnpackStack(args, nargs, "truncate",
- 0, 1,
- &pos)) {
+ if (!_PyArg_CheckPositional("truncate", nargs, 0, 1)) {
goto exit;
}
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ pos = args[0];
+skip_optional:
return_value = _io_TextIOWrapper_truncate_impl(self, pos);
exit:
@@ -548,4 +551,4 @@ _io_TextIOWrapper_close(textio *self, PyObject *Py_UNUSED(ignored))
{
return _io_TextIOWrapper_close_impl(self);
}
-/*[clinic end generated code: output=8bdd1035bf878d6f input=a9049054013a1b77]*/
+/*[clinic end generated code: output=c3d1b2a5d2d2d429 input=a9049054013a1b77]*/
diff --git a/Modules/cjkcodecs/clinic/multibytecodec.c.h b/Modules/cjkcodecs/clinic/multibytecodec.c.h
index 871bf33..c62a641 100644
--- a/Modules/cjkcodecs/clinic/multibytecodec.c.h
+++ b/Modules/cjkcodecs/clinic/multibytecodec.c.h
@@ -296,11 +296,14 @@ _multibytecodec_MultibyteStreamReader_read(MultibyteStreamReaderObject *self, Py
PyObject *return_value = NULL;
PyObject *sizeobj = Py_None;
- if (!_PyArg_UnpackStack(args, nargs, "read",
- 0, 1,
- &sizeobj)) {
+ if (!_PyArg_CheckPositional("read", nargs, 0, 1)) {
goto exit;
}
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ sizeobj = args[0];
+skip_optional:
return_value = _multibytecodec_MultibyteStreamReader_read_impl(self, sizeobj);
exit:
@@ -325,11 +328,14 @@ _multibytecodec_MultibyteStreamReader_readline(MultibyteStreamReaderObject *self
PyObject *return_value = NULL;
PyObject *sizeobj = Py_None;
- if (!_PyArg_UnpackStack(args, nargs, "readline",
- 0, 1,
- &sizeobj)) {
+ if (!_PyArg_CheckPositional("readline", nargs, 0, 1)) {
goto exit;
}
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ sizeobj = args[0];
+skip_optional:
return_value = _multibytecodec_MultibyteStreamReader_readline_impl(self, sizeobj);
exit:
@@ -354,11 +360,14 @@ _multibytecodec_MultibyteStreamReader_readlines(MultibyteStreamReaderObject *sel
PyObject *return_value = NULL;
PyObject *sizehintobj = Py_None;
- if (!_PyArg_UnpackStack(args, nargs, "readlines",
- 0, 1,
- &sizehintobj)) {
+ if (!_PyArg_CheckPositional("readlines", nargs, 0, 1)) {
goto exit;
}
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ sizehintobj = args[0];
+skip_optional:
return_value = _multibytecodec_MultibyteStreamReader_readlines_impl(self, sizehintobj);
exit:
@@ -422,4 +431,4 @@ PyDoc_STRVAR(_multibytecodec___create_codec__doc__,
#define _MULTIBYTECODEC___CREATE_CODEC_METHODDEF \
{"__create_codec", (PyCFunction)_multibytecodec___create_codec, METH_O, _multibytecodec___create_codec__doc__},
-/*[clinic end generated code: output=2ed7030b28a79029 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=bcd6311010557faf input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_abc.c.h b/Modules/clinic/_abc.c.h
index 22ddb6c..62c6552 100644
--- a/Modules/clinic/_abc.c.h
+++ b/Modules/clinic/_abc.c.h
@@ -65,11 +65,11 @@ _abc__abc_register(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *self;
PyObject *subclass;
- if (!_PyArg_UnpackStack(args, nargs, "_abc_register",
- 2, 2,
- &self, &subclass)) {
+ if (!_PyArg_CheckPositional("_abc_register", nargs, 2, 2)) {
goto exit;
}
+ self = args[0];
+ subclass = args[1];
return_value = _abc__abc_register_impl(module, self, subclass);
exit:
@@ -96,11 +96,11 @@ _abc__abc_instancecheck(PyObject *module, PyObject *const *args, Py_ssize_t narg
PyObject *self;
PyObject *instance;
- if (!_PyArg_UnpackStack(args, nargs, "_abc_instancecheck",
- 2, 2,
- &self, &instance)) {
+ if (!_PyArg_CheckPositional("_abc_instancecheck", nargs, 2, 2)) {
goto exit;
}
+ self = args[0];
+ instance = args[1];
return_value = _abc__abc_instancecheck_impl(module, self, instance);
exit:
@@ -127,11 +127,11 @@ _abc__abc_subclasscheck(PyObject *module, PyObject *const *args, Py_ssize_t narg
PyObject *self;
PyObject *subclass;
- if (!_PyArg_UnpackStack(args, nargs, "_abc_subclasscheck",
- 2, 2,
- &self, &subclass)) {
+ if (!_PyArg_CheckPositional("_abc_subclasscheck", nargs, 2, 2)) {
goto exit;
}
+ self = args[0];
+ subclass = args[1];
return_value = _abc__abc_subclasscheck_impl(module, self, subclass);
exit:
@@ -159,4 +159,4 @@ _abc_get_cache_token(PyObject *module, PyObject *Py_UNUSED(ignored))
{
return _abc_get_cache_token_impl(module);
}
-/*[clinic end generated code: output=606db3cb658d9240 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=2544b4b5ae50a089 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_cursesmodule.c.h b/Modules/clinic/_cursesmodule.c.h
index 0988581..659fd4e 100644
--- a/Modules/clinic/_cursesmodule.c.h
+++ b/Modules/clinic/_cursesmodule.c.h
@@ -468,11 +468,42 @@ _curses_window_border(PyCursesWindowObject *self, PyObject *const *args, Py_ssiz
PyObject *bl = NULL;
PyObject *br = NULL;
- if (!_PyArg_UnpackStack(args, nargs, "border",
- 0, 8,
- &ls, &rs, &ts, &bs, &tl, &tr, &bl, &br)) {
+ if (!_PyArg_CheckPositional("border", nargs, 0, 8)) {
goto exit;
}
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ ls = args[0];
+ if (nargs < 2) {
+ goto skip_optional;
+ }
+ rs = args[1];
+ if (nargs < 3) {
+ goto skip_optional;
+ }
+ ts = args[2];
+ if (nargs < 4) {
+ goto skip_optional;
+ }
+ bs = args[3];
+ if (nargs < 5) {
+ goto skip_optional;
+ }
+ tl = args[4];
+ if (nargs < 6) {
+ goto skip_optional;
+ }
+ tr = args[5];
+ if (nargs < 7) {
+ goto skip_optional;
+ }
+ bl = args[6];
+ if (nargs < 8) {
+ goto skip_optional;
+ }
+ br = args[7];
+skip_optional:
return_value = _curses_window_border_impl(self, ls, rs, ts, bs, tl, tr, bl, br);
exit:
@@ -4500,4 +4531,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=ceb2e32ee1370033 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=5305982cb312a911 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_elementtree.c.h b/Modules/clinic/_elementtree.c.h
index 8968983..1293acd 100644
--- a/Modules/clinic/_elementtree.c.h
+++ b/Modules/clinic/_elementtree.c.h
@@ -504,11 +504,11 @@ _elementtree_Element_makeelement(ElementObject *self, PyObject *const *args, Py_
PyObject *tag;
PyObject *attrib;
- if (!_PyArg_UnpackStack(args, nargs, "makeelement",
- 2, 2,
- &tag, &attrib)) {
+ if (!_PyArg_CheckPositional("makeelement", nargs, 2, 2)) {
goto exit;
}
+ tag = args[0];
+ attrib = args[1];
return_value = _elementtree_Element_makeelement_impl(self, tag, attrib);
exit:
@@ -562,11 +562,11 @@ _elementtree_Element_set(ElementObject *self, PyObject *const *args, Py_ssize_t
PyObject *key;
PyObject *value;
- if (!_PyArg_UnpackStack(args, nargs, "set",
- 2, 2,
- &key, &value)) {
+ if (!_PyArg_CheckPositional("set", nargs, 2, 2)) {
goto exit;
}
+ key = args[0];
+ value = args[1];
return_value = _elementtree_Element_set_impl(self, key, value);
exit:
@@ -647,11 +647,15 @@ _elementtree_TreeBuilder_start(TreeBuilderObject *self, PyObject *const *args, P
PyObject *tag;
PyObject *attrs = Py_None;
- if (!_PyArg_UnpackStack(args, nargs, "start",
- 1, 2,
- &tag, &attrs)) {
+ if (!_PyArg_CheckPositional("start", nargs, 1, 2)) {
goto exit;
}
+ tag = args[0];
+ if (nargs < 2) {
+ goto skip_optional;
+ }
+ attrs = args[1];
+skip_optional:
return_value = _elementtree_TreeBuilder_start_impl(self, tag, attrs);
exit:
@@ -734,14 +738,18 @@ _elementtree_XMLParser__setevents(XMLParserObject *self, PyObject *const *args,
PyObject *events_queue;
PyObject *events_to_report = Py_None;
- if (!_PyArg_UnpackStack(args, nargs, "_setevents",
- 1, 2,
- &events_queue, &events_to_report)) {
+ if (!_PyArg_CheckPositional("_setevents", nargs, 1, 2)) {
goto exit;
}
+ events_queue = args[0];
+ if (nargs < 2) {
+ goto skip_optional;
+ }
+ events_to_report = args[1];
+skip_optional:
return_value = _elementtree_XMLParser__setevents_impl(self, events_queue, events_to_report);
exit:
return return_value;
}
-/*[clinic end generated code: output=6bbedd24b709dc00 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=0c15c41e03a7829f input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_gdbmmodule.c.h b/Modules/clinic/_gdbmmodule.c.h
index 9475264..15f47dc 100644
--- a/Modules/clinic/_gdbmmodule.c.h
+++ b/Modules/clinic/_gdbmmodule.c.h
@@ -21,11 +21,15 @@ _gdbm_gdbm_get(dbmobject *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *key;
PyObject *default_value = Py_None;
- if (!_PyArg_UnpackStack(args, nargs, "get",
- 1, 2,
- &key, &default_value)) {
+ if (!_PyArg_CheckPositional("get", nargs, 1, 2)) {
goto exit;
}
+ key = args[0];
+ if (nargs < 2) {
+ goto skip_optional;
+ }
+ default_value = args[1];
+skip_optional:
return_value = _gdbm_gdbm_get_impl(self, key, default_value);
exit:
@@ -52,11 +56,15 @@ _gdbm_gdbm_setdefault(dbmobject *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *key;
PyObject *default_value = Py_None;
- if (!_PyArg_UnpackStack(args, nargs, "setdefault",
- 1, 2,
- &key, &default_value)) {
+ if (!_PyArg_CheckPositional("setdefault", nargs, 1, 2)) {
goto exit;
}
+ key = args[0];
+ if (nargs < 2) {
+ goto skip_optional;
+ }
+ default_value = args[1];
+skip_optional:
return_value = _gdbm_gdbm_setdefault_impl(self, key, default_value);
exit:
@@ -290,4 +298,4 @@ skip_optional:
exit:
return return_value;
}
-/*[clinic end generated code: output=05f06065d2dc1f9e input=a9049054013a1b77]*/
+/*[clinic end generated code: output=0a72598e5a3acd60 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_heapqmodule.c.h b/Modules/clinic/_heapqmodule.c.h
index 0b5d0d7..5540370 100644
--- a/Modules/clinic/_heapqmodule.c.h
+++ b/Modules/clinic/_heapqmodule.c.h
@@ -21,11 +21,11 @@ _heapq_heappush(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *heap;
PyObject *item;
- if (!_PyArg_UnpackStack(args, nargs, "heappush",
- 2, 2,
- &heap, &item)) {
+ if (!_PyArg_CheckPositional("heappush", nargs, 2, 2)) {
goto exit;
}
+ heap = args[0];
+ item = args[1];
return_value = _heapq_heappush_impl(module, heap, item);
exit:
@@ -68,11 +68,11 @@ _heapq_heapreplace(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *heap;
PyObject *item;
- if (!_PyArg_UnpackStack(args, nargs, "heapreplace",
- 2, 2,
- &heap, &item)) {
+ if (!_PyArg_CheckPositional("heapreplace", nargs, 2, 2)) {
goto exit;
}
+ heap = args[0];
+ item = args[1];
return_value = _heapq_heapreplace_impl(module, heap, item);
exit:
@@ -101,11 +101,11 @@ _heapq_heappushpop(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *heap;
PyObject *item;
- if (!_PyArg_UnpackStack(args, nargs, "heappushpop",
- 2, 2,
- &heap, &item)) {
+ if (!_PyArg_CheckPositional("heappushpop", nargs, 2, 2)) {
goto exit;
}
+ heap = args[0];
+ item = args[1];
return_value = _heapq_heappushpop_impl(module, heap, item);
exit:
@@ -150,11 +150,11 @@ _heapq__heapreplace_max(PyObject *module, PyObject *const *args, Py_ssize_t narg
PyObject *heap;
PyObject *item;
- if (!_PyArg_UnpackStack(args, nargs, "_heapreplace_max",
- 2, 2,
- &heap, &item)) {
+ if (!_PyArg_CheckPositional("_heapreplace_max", nargs, 2, 2)) {
goto exit;
}
+ heap = args[0];
+ item = args[1];
return_value = _heapq__heapreplace_max_impl(module, heap, item);
exit:
@@ -169,4 +169,4 @@ PyDoc_STRVAR(_heapq__heapify_max__doc__,
#define _HEAPQ__HEAPIFY_MAX_METHODDEF \
{"_heapify_max", (PyCFunction)_heapq__heapify_max, METH_O, _heapq__heapify_max__doc__},
-/*[clinic end generated code: output=b73e874eeb9977b6 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=37ef2a3319971c8d input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_operator.c.h b/Modules/clinic/_operator.c.h
index 72c0e57..f9e353d 100644
--- a/Modules/clinic/_operator.c.h
+++ b/Modules/clinic/_operator.c.h
@@ -49,11 +49,11 @@ _operator_add(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "add",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("add", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_add_impl(module, a, b);
exit:
@@ -79,11 +79,11 @@ _operator_sub(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "sub",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("sub", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_sub_impl(module, a, b);
exit:
@@ -109,11 +109,11 @@ _operator_mul(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "mul",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("mul", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_mul_impl(module, a, b);
exit:
@@ -139,11 +139,11 @@ _operator_matmul(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "matmul",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("matmul", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_matmul_impl(module, a, b);
exit:
@@ -169,11 +169,11 @@ _operator_floordiv(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "floordiv",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("floordiv", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_floordiv_impl(module, a, b);
exit:
@@ -199,11 +199,11 @@ _operator_truediv(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "truediv",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("truediv", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_truediv_impl(module, a, b);
exit:
@@ -229,11 +229,11 @@ _operator_mod(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "mod",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("mod", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_mod_impl(module, a, b);
exit:
@@ -304,11 +304,11 @@ _operator_lshift(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "lshift",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("lshift", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_lshift_impl(module, a, b);
exit:
@@ -334,11 +334,11 @@ _operator_rshift(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "rshift",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("rshift", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_rshift_impl(module, a, b);
exit:
@@ -392,11 +392,11 @@ _operator_and_(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "and_",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("and_", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_and__impl(module, a, b);
exit:
@@ -422,11 +422,11 @@ _operator_xor(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "xor",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("xor", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_xor_impl(module, a, b);
exit:
@@ -452,11 +452,11 @@ _operator_or_(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "or_",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("or_", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_or__impl(module, a, b);
exit:
@@ -482,11 +482,11 @@ _operator_iadd(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "iadd",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("iadd", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_iadd_impl(module, a, b);
exit:
@@ -512,11 +512,11 @@ _operator_isub(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "isub",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("isub", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_isub_impl(module, a, b);
exit:
@@ -542,11 +542,11 @@ _operator_imul(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "imul",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("imul", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_imul_impl(module, a, b);
exit:
@@ -572,11 +572,11 @@ _operator_imatmul(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "imatmul",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("imatmul", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_imatmul_impl(module, a, b);
exit:
@@ -602,11 +602,11 @@ _operator_ifloordiv(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "ifloordiv",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("ifloordiv", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_ifloordiv_impl(module, a, b);
exit:
@@ -632,11 +632,11 @@ _operator_itruediv(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "itruediv",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("itruediv", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_itruediv_impl(module, a, b);
exit:
@@ -662,11 +662,11 @@ _operator_imod(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "imod",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("imod", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_imod_impl(module, a, b);
exit:
@@ -692,11 +692,11 @@ _operator_ilshift(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "ilshift",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("ilshift", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_ilshift_impl(module, a, b);
exit:
@@ -722,11 +722,11 @@ _operator_irshift(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "irshift",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("irshift", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_irshift_impl(module, a, b);
exit:
@@ -752,11 +752,11 @@ _operator_iand(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "iand",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("iand", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_iand_impl(module, a, b);
exit:
@@ -782,11 +782,11 @@ _operator_ixor(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "ixor",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("ixor", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_ixor_impl(module, a, b);
exit:
@@ -812,11 +812,11 @@ _operator_ior(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "ior",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("ior", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_ior_impl(module, a, b);
exit:
@@ -842,11 +842,11 @@ _operator_concat(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "concat",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("concat", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_concat_impl(module, a, b);
exit:
@@ -872,11 +872,11 @@ _operator_iconcat(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "iconcat",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("iconcat", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_iconcat_impl(module, a, b);
exit:
@@ -903,11 +903,11 @@ _operator_contains(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *b;
int _return_value;
- if (!_PyArg_UnpackStack(args, nargs, "contains",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("contains", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
_return_value = _operator_contains_impl(module, a, b);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
@@ -938,11 +938,11 @@ _operator_indexOf(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *b;
Py_ssize_t _return_value;
- if (!_PyArg_UnpackStack(args, nargs, "indexOf",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("indexOf", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
_return_value = _operator_indexOf_impl(module, a, b);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
@@ -973,11 +973,11 @@ _operator_countOf(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *b;
Py_ssize_t _return_value;
- if (!_PyArg_UnpackStack(args, nargs, "countOf",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("countOf", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
_return_value = _operator_countOf_impl(module, a, b);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
@@ -1007,11 +1007,11 @@ _operator_getitem(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "getitem",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("getitem", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_getitem_impl(module, a, b);
exit:
@@ -1039,11 +1039,12 @@ _operator_setitem(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *b;
PyObject *c;
- if (!_PyArg_UnpackStack(args, nargs, "setitem",
- 3, 3,
- &a, &b, &c)) {
+ if (!_PyArg_CheckPositional("setitem", nargs, 3, 3)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
+ c = args[2];
return_value = _operator_setitem_impl(module, a, b, c);
exit:
@@ -1069,11 +1070,11 @@ _operator_delitem(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "delitem",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("delitem", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_delitem_impl(module, a, b);
exit:
@@ -1099,11 +1100,11 @@ _operator_eq(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "eq",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("eq", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_eq_impl(module, a, b);
exit:
@@ -1129,11 +1130,11 @@ _operator_ne(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "ne",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("ne", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_ne_impl(module, a, b);
exit:
@@ -1159,11 +1160,11 @@ _operator_lt(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "lt",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("lt", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_lt_impl(module, a, b);
exit:
@@ -1189,11 +1190,11 @@ _operator_le(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "le",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("le", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_le_impl(module, a, b);
exit:
@@ -1219,11 +1220,11 @@ _operator_gt(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "gt",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("gt", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_gt_impl(module, a, b);
exit:
@@ -1249,11 +1250,11 @@ _operator_ge(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "ge",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("ge", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_ge_impl(module, a, b);
exit:
@@ -1279,11 +1280,11 @@ _operator_pow(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "pow",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("pow", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_pow_impl(module, a, b);
exit:
@@ -1309,11 +1310,11 @@ _operator_ipow(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "ipow",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("ipow", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_ipow_impl(module, a, b);
exit:
@@ -1348,11 +1349,11 @@ _operator_is_(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "is_",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("is_", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_is__impl(module, a, b);
exit:
@@ -1378,11 +1379,11 @@ _operator_is_not(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "is_not",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("is_not", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator_is_not_impl(module, a, b);
exit:
@@ -1480,14 +1481,14 @@ _operator__compare_digest(PyObject *module, PyObject *const *args, Py_ssize_t na
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "_compare_digest",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("_compare_digest", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = _operator__compare_digest_impl(module, a, b);
exit:
return return_value;
}
-/*[clinic end generated code: output=b382bece80a5a254 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=e7ed71a8c475a901 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_pickle.c.h b/Modules/clinic/_pickle.c.h
index 3f6be4b..2759b2f2 100644
--- a/Modules/clinic/_pickle.c.h
+++ b/Modules/clinic/_pickle.c.h
@@ -213,11 +213,11 @@ _pickle_Unpickler_find_class(UnpicklerObject *self, PyObject *const *args, Py_ss
PyObject *module_name;
PyObject *global_name;
- if (!_PyArg_UnpackStack(args, nargs, "find_class",
- 2, 2,
- &module_name, &global_name)) {
+ if (!_PyArg_CheckPositional("find_class", nargs, 2, 2)) {
goto exit;
}
+ module_name = args[0];
+ global_name = args[1];
return_value = _pickle_Unpickler_find_class_impl(self, module_name, global_name);
exit:
@@ -562,4 +562,4 @@ _pickle_loads(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
exit:
return return_value;
}
-/*[clinic end generated code: output=4b32d63ff58b64d8 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=225f06abcf27ed2b input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_sre.c.h b/Modules/clinic/_sre.c.h
index e8a3665..e5bb32f 100644
--- a/Modules/clinic/_sre.c.h
+++ b/Modules/clinic/_sre.c.h
@@ -653,11 +653,14 @@ _sre_SRE_Match_start(MatchObject *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *group = NULL;
Py_ssize_t _return_value;
- if (!_PyArg_UnpackStack(args, nargs, "start",
- 0, 1,
- &group)) {
+ if (!_PyArg_CheckPositional("start", nargs, 0, 1)) {
goto exit;
}
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ group = args[0];
+skip_optional:
_return_value = _sre_SRE_Match_start_impl(self, group);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
@@ -687,11 +690,14 @@ _sre_SRE_Match_end(MatchObject *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *group = NULL;
Py_ssize_t _return_value;
- if (!_PyArg_UnpackStack(args, nargs, "end",
- 0, 1,
- &group)) {
+ if (!_PyArg_CheckPositional("end", nargs, 0, 1)) {
goto exit;
}
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ group = args[0];
+skip_optional:
_return_value = _sre_SRE_Match_end_impl(self, group);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
@@ -720,11 +726,14 @@ _sre_SRE_Match_span(MatchObject *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *return_value = NULL;
PyObject *group = NULL;
- if (!_PyArg_UnpackStack(args, nargs, "span",
- 0, 1,
- &group)) {
+ if (!_PyArg_CheckPositional("span", nargs, 0, 1)) {
goto exit;
}
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ group = args[0];
+skip_optional:
return_value = _sre_SRE_Match_span_impl(self, group);
exit:
@@ -789,4 +798,4 @@ _sre_SRE_Scanner_search(ScannerObject *self, PyObject *Py_UNUSED(ignored))
{
return _sre_SRE_Scanner_search_impl(self);
}
-/*[clinic end generated code: output=7992634045212b26 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=8d19359d6a4a3a7e input=a9049054013a1b77]*/
diff --git a/Modules/clinic/itertoolsmodule.c.h b/Modules/clinic/itertoolsmodule.c.h
index 9fc429a..bcf4c5f 100644
--- a/Modules/clinic/itertoolsmodule.c.h
+++ b/Modules/clinic/itertoolsmodule.c.h
@@ -124,11 +124,10 @@ itertools__tee(PyTypeObject *type, PyObject *args, PyObject *kwargs)
!_PyArg_NoKeywords("_tee", kwargs)) {
goto exit;
}
- if (!PyArg_UnpackTuple(args, "_tee",
- 1, 1,
- &iterable)) {
+ if (!_PyArg_CheckPositional("_tee", PyTuple_GET_SIZE(args), 1, 1)) {
goto exit;
}
+ iterable = PyTuple_GET_ITEM(args, 0);
return_value = itertools__tee_impl(type, iterable);
exit:
@@ -204,11 +203,10 @@ itertools_cycle(PyTypeObject *type, PyObject *args, PyObject *kwargs)
!_PyArg_NoKeywords("cycle", kwargs)) {
goto exit;
}
- if (!PyArg_UnpackTuple(args, "cycle",
- 1, 1,
- &iterable)) {
+ if (!_PyArg_CheckPositional("cycle", PyTuple_GET_SIZE(args), 1, 1)) {
goto exit;
}
+ iterable = PyTuple_GET_ITEM(args, 0);
return_value = itertools_cycle_impl(type, iterable);
exit:
@@ -237,11 +235,11 @@ itertools_dropwhile(PyTypeObject *type, PyObject *args, PyObject *kwargs)
!_PyArg_NoKeywords("dropwhile", kwargs)) {
goto exit;
}
- if (!PyArg_UnpackTuple(args, "dropwhile",
- 2, 2,
- &func, &seq)) {
+ if (!_PyArg_CheckPositional("dropwhile", PyTuple_GET_SIZE(args), 2, 2)) {
goto exit;
}
+ func = PyTuple_GET_ITEM(args, 0);
+ seq = PyTuple_GET_ITEM(args, 1);
return_value = itertools_dropwhile_impl(type, func, seq);
exit:
@@ -268,11 +266,11 @@ itertools_takewhile(PyTypeObject *type, PyObject *args, PyObject *kwargs)
!_PyArg_NoKeywords("takewhile", kwargs)) {
goto exit;
}
- if (!PyArg_UnpackTuple(args, "takewhile",
- 2, 2,
- &func, &seq)) {
+ if (!_PyArg_CheckPositional("takewhile", PyTuple_GET_SIZE(args), 2, 2)) {
goto exit;
}
+ func = PyTuple_GET_ITEM(args, 0);
+ seq = PyTuple_GET_ITEM(args, 1);
return_value = itertools_takewhile_impl(type, func, seq);
exit:
@@ -299,11 +297,11 @@ itertools_starmap(PyTypeObject *type, PyObject *args, PyObject *kwargs)
!_PyArg_NoKeywords("starmap", kwargs)) {
goto exit;
}
- if (!PyArg_UnpackTuple(args, "starmap",
- 2, 2,
- &func, &seq)) {
+ if (!_PyArg_CheckPositional("starmap", PyTuple_GET_SIZE(args), 2, 2)) {
goto exit;
}
+ func = PyTuple_GET_ITEM(args, 0);
+ seq = PyTuple_GET_ITEM(args, 1);
return_value = itertools_starmap_impl(type, func, seq);
exit:
@@ -496,11 +494,11 @@ itertools_filterfalse(PyTypeObject *type, PyObject *args, PyObject *kwargs)
!_PyArg_NoKeywords("filterfalse", kwargs)) {
goto exit;
}
- if (!PyArg_UnpackTuple(args, "filterfalse",
- 2, 2,
- &func, &seq)) {
+ if (!_PyArg_CheckPositional("filterfalse", PyTuple_GET_SIZE(args), 2, 2)) {
goto exit;
}
+ func = PyTuple_GET_ITEM(args, 0);
+ seq = PyTuple_GET_ITEM(args, 1);
return_value = itertools_filterfalse_impl(type, func, seq);
exit:
@@ -542,4 +540,4 @@ itertools_count(PyTypeObject *type, PyObject *args, PyObject *kwargs)
exit:
return return_value;
}
-/*[clinic end generated code: output=f289354f54e04c13 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=3d0ca69707b60715 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/mathmodule.c.h b/Modules/clinic/mathmodule.c.h
index 1165789..1c8fc2f 100644
--- a/Modules/clinic/mathmodule.c.h
+++ b/Modules/clinic/mathmodule.c.h
@@ -21,11 +21,11 @@ math_gcd(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *a;
PyObject *b;
- if (!_PyArg_UnpackStack(args, nargs, "gcd",
- 2, 2,
- &a, &b)) {
+ if (!_PyArg_CheckPositional("gcd", nargs, 2, 2)) {
goto exit;
}
+ a = args[0];
+ b = args[1];
return_value = math_gcd_impl(module, a, b);
exit:
@@ -307,11 +307,11 @@ math_dist(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *p;
PyObject *q;
- if (!_PyArg_UnpackStack(args, nargs, "dist",
- 2, 2,
- &p, &q)) {
+ if (!_PyArg_CheckPositional("dist", nargs, 2, 2)) {
goto exit;
}
+ p = args[0];
+ q = args[1];
return_value = math_dist_impl(module, p, q);
exit:
@@ -548,4 +548,4 @@ math_isclose(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
exit:
return return_value;
}
-/*[clinic end generated code: output=2fe4fecd85585313 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=f3264ab0ef57ba0a input=a9049054013a1b77]*/
diff --git a/Modules/clinic/selectmodule.c.h b/Modules/clinic/selectmodule.c.h
index 655e24c..c2ef26f 100644
--- a/Modules/clinic/selectmodule.c.h
+++ b/Modules/clinic/selectmodule.c.h
@@ -45,11 +45,17 @@ select_select(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *xlist;
PyObject *timeout_obj = Py_None;
- if (!_PyArg_UnpackStack(args, nargs, "select",
- 3, 4,
- &rlist, &wlist, &xlist, &timeout_obj)) {
+ if (!_PyArg_CheckPositional("select", nargs, 3, 4)) {
goto exit;
}
+ rlist = args[0];
+ wlist = args[1];
+ xlist = args[2];
+ if (nargs < 4) {
+ goto skip_optional;
+ }
+ timeout_obj = args[3];
+skip_optional:
return_value = select_select_impl(module, rlist, wlist, xlist, timeout_obj);
exit:
@@ -201,11 +207,14 @@ select_poll_poll(pollObject *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *return_value = NULL;
PyObject *timeout_obj = Py_None;
- if (!_PyArg_UnpackStack(args, nargs, "poll",
- 0, 1,
- &timeout_obj)) {
+ if (!_PyArg_CheckPositional("poll", nargs, 0, 1)) {
goto exit;
}
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ timeout_obj = args[0];
+skip_optional:
return_value = select_poll_poll_impl(self, timeout_obj);
exit:
@@ -366,11 +375,14 @@ select_devpoll_poll(devpollObject *self, PyObject *const *args, Py_ssize_t nargs
PyObject *return_value = NULL;
PyObject *timeout_obj = Py_None;
- if (!_PyArg_UnpackStack(args, nargs, "poll",
- 0, 1,
- &timeout_obj)) {
+ if (!_PyArg_CheckPositional("poll", nargs, 0, 1)) {
goto exit;
}
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ timeout_obj = args[0];
+skip_optional:
return_value = select_devpoll_poll_impl(self, timeout_obj);
exit:
@@ -808,11 +820,22 @@ select_epoll___exit__(pyEpoll_Object *self, PyObject *const *args, Py_ssize_t na
PyObject *exc_value = Py_None;
PyObject *exc_tb = Py_None;
- if (!_PyArg_UnpackStack(args, nargs, "__exit__",
- 0, 3,
- &exc_type, &exc_value, &exc_tb)) {
+ if (!_PyArg_CheckPositional("__exit__", nargs, 0, 3)) {
goto exit;
}
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ exc_type = args[0];
+ if (nargs < 2) {
+ goto skip_optional;
+ }
+ exc_value = args[1];
+ if (nargs < 3) {
+ goto skip_optional;
+ }
+ exc_tb = args[2];
+skip_optional:
return_value = select_epoll___exit___impl(self, exc_type, exc_value, exc_tb);
exit:
@@ -1105,4 +1128,4 @@ exit:
#ifndef SELECT_KQUEUE_CONTROL_METHODDEF
#define SELECT_KQUEUE_CONTROL_METHODDEF
#endif /* !defined(SELECT_KQUEUE_CONTROL_METHODDEF) */
-/*[clinic end generated code: output=20da8f9c050e1b65 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=3e40b33a3294d03d input=a9049054013a1b77]*/