summaryrefslogtreecommitdiffstats
path: root/Modules/_sre
diff options
context:
space:
mode:
authorErlend E. Aasland <erlend@python.org>2024-02-05 20:49:17 (GMT)
committerGitHub <noreply@github.com>2024-02-05 20:49:17 (GMT)
commit09096a1647913526a3d4fa69a9d2056ec82a8f37 (patch)
tree906760eb46b791e15777b34a2a8bd21399ab5b27 /Modules/_sre
parent4aa4f0906df9fc9c6c6f6657f2c521468c6b1688 (diff)
downloadcpython-09096a1647913526a3d4fa69a9d2056ec82a8f37.zip
cpython-09096a1647913526a3d4fa69a9d2056ec82a8f37.tar.gz
cpython-09096a1647913526a3d4fa69a9d2056ec82a8f37.tar.bz2
gh-115015: Argument Clinic: fix generated code for METH_METHOD methods without params (#115016)
Diffstat (limited to 'Modules/_sre')
-rw-r--r--Modules/_sre/clinic/sre.c.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/Modules/_sre/clinic/sre.c.h b/Modules/_sre/clinic/sre.c.h
index cd3fbbc..48336c7 100644
--- a/Modules/_sre/clinic/sre.c.h
+++ b/Modules/_sre/clinic/sre.c.h
@@ -1434,7 +1434,7 @@ _sre_SRE_Scanner_match_impl(ScannerObject *self, PyTypeObject *cls);
static PyObject *
_sre_SRE_Scanner_match(ScannerObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
- if (nargs) {
+ if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
PyErr_SetString(PyExc_TypeError, "match() takes no arguments");
return NULL;
}
@@ -1455,10 +1455,10 @@ _sre_SRE_Scanner_search_impl(ScannerObject *self, PyTypeObject *cls);
static PyObject *
_sre_SRE_Scanner_search(ScannerObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
- if (nargs) {
+ if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
PyErr_SetString(PyExc_TypeError, "search() takes no arguments");
return NULL;
}
return _sre_SRE_Scanner_search_impl(self, cls);
}
-/*[clinic end generated code: output=ad513f31b99505fa input=a9049054013a1b77]*/
+/*[clinic end generated code: output=c3e711f0b2f43d66 input=a9049054013a1b77]*/