summaryrefslogtreecommitdiffstats
path: root/Modules/clinic/_queuemodule.c.h
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2022-04-30 10:15:02 (GMT)
committerGitHub <noreply@github.com>2022-04-30 10:15:02 (GMT)
commita055dac0b45031878a8196a8735522de018491e3 (patch)
tree5228f98a9ce93456c5d3db84a3fed0096b8f0f38 /Modules/clinic/_queuemodule.c.h
parent19dca041212f9f58ee11833bff3f8c157d4fd3e8 (diff)
downloadcpython-a055dac0b45031878a8196a8735522de018491e3.zip
cpython-a055dac0b45031878a8196a8735522de018491e3.tar.gz
cpython-a055dac0b45031878a8196a8735522de018491e3.tar.bz2
gh-91583: AC: Fix regression for functions with defining_class (GH-91739)
Argument Clinic now generates the same efficient code as before adding the defining_class parameter.
Diffstat (limited to 'Modules/clinic/_queuemodule.c.h')
-rw-r--r--Modules/clinic/_queuemodule.c.h39
1 files changed, 24 insertions, 15 deletions
diff --git a/Modules/clinic/_queuemodule.c.h b/Modules/clinic/_queuemodule.c.h
index 22d2e99..056a8ef 100644
--- a/Modules/clinic/_queuemodule.c.h
+++ b/Modules/clinic/_queuemodule.c.h
@@ -146,14 +146,30 @@ _queue_SimpleQueue_get(simplequeueobject *self, PyTypeObject *cls, PyObject *con
{
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_obj = Py_None;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &block, &timeout_obj)) {
+ 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_obj = args[1];
+skip_optional_pos:
return_value = _queue_SimpleQueue_get_impl(self, cls, block, timeout_obj);
exit:
@@ -179,18 +195,11 @@ _queue_SimpleQueue_get_nowait_impl(simplequeueobject *self,
static PyObject *
_queue_SimpleQueue_get_nowait(simplequeueobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
- PyObject *return_value = NULL;
- static const char * const _keywords[] = { NULL};
- static _PyArg_Parser _parser = {":get_nowait", _keywords, 0};
-
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
- )) {
- goto exit;
+ if (nargs) {
+ PyErr_SetString(PyExc_TypeError, "get_nowait() takes no arguments");
+ return NULL;
}
- return_value = _queue_SimpleQueue_get_nowait_impl(self, cls);
-
-exit:
- return return_value;
+ return _queue_SimpleQueue_get_nowait_impl(self, cls);
}
PyDoc_STRVAR(_queue_SimpleQueue_empty__doc__,
@@ -248,4 +257,4 @@ _queue_SimpleQueue_qsize(simplequeueobject *self, PyObject *Py_UNUSED(ignored))
exit:
return return_value;
}
-/*[clinic end generated code: output=acfaf0191d8935db input=a9049054013a1b77]*/
+/*[clinic end generated code: output=36301c405a858f39 input=a9049054013a1b77]*/