summaryrefslogtreecommitdiffstats
path: root/Modules/clinic/_sre.c.h
diff options
context:
space:
mode:
authorSylvain <sylvain.desodt+github@gmail.com>2017-06-10 04:51:48 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2017-06-10 04:51:48 (GMT)
commit7445381c606faf20e253da42656db478a4349f8e (patch)
tree49ad79e5347454d1bbfeb1c2d06d3d09fd9b273f /Modules/clinic/_sre.c.h
parente5f6e86c48c7b2eb9e1d6a0e72867b4d8b4720f3 (diff)
downloadcpython-7445381c606faf20e253da42656db478a4349f8e.zip
cpython-7445381c606faf20e253da42656db478a4349f8e.tar.gz
cpython-7445381c606faf20e253da42656db478a4349f8e.tar.bz2
bpo-30600: Fix error messages (condition order in Argument Clinic) (#2051)
The function '_PyArg_ParseStack()' and '_PyArg_UnpackStack' were failing (with error "XXX() takes Y argument (Z given)") before the function '_PyArg_NoStackKeywords()' was called. Thus, the latter did not raise its more meaningful error : "XXX() takes no keyword arguments".
Diffstat (limited to 'Modules/clinic/_sre.c.h')
-rw-r--r--Modules/clinic/_sre.c.h26
1 files changed, 13 insertions, 13 deletions
diff --git a/Modules/clinic/_sre.c.h b/Modules/clinic/_sre.c.h
index 1e60686..b5e1b82 100644
--- a/Modules/clinic/_sre.c.h
+++ b/Modules/clinic/_sre.c.h
@@ -629,13 +629,13 @@ _sre_SRE_Match_start(MatchObject *self, PyObject **args, Py_ssize_t nargs, PyObj
PyObject *group = NULL;
Py_ssize_t _return_value;
- if (!_PyArg_UnpackStack(args, nargs, "start",
- 0, 1,
- &group)) {
+ if (!_PyArg_NoStackKeywords("start", kwnames)) {
goto exit;
}
- if (!_PyArg_NoStackKeywords("start", kwnames)) {
+ if (!_PyArg_UnpackStack(args, nargs, "start",
+ 0, 1,
+ &group)) {
goto exit;
}
_return_value = _sre_SRE_Match_start_impl(self, group);
@@ -667,13 +667,13 @@ _sre_SRE_Match_end(MatchObject *self, PyObject **args, Py_ssize_t nargs, PyObjec
PyObject *group = NULL;
Py_ssize_t _return_value;
- if (!_PyArg_UnpackStack(args, nargs, "end",
- 0, 1,
- &group)) {
+ if (!_PyArg_NoStackKeywords("end", kwnames)) {
goto exit;
}
- if (!_PyArg_NoStackKeywords("end", kwnames)) {
+ if (!_PyArg_UnpackStack(args, nargs, "end",
+ 0, 1,
+ &group)) {
goto exit;
}
_return_value = _sre_SRE_Match_end_impl(self, group);
@@ -704,13 +704,13 @@ _sre_SRE_Match_span(MatchObject *self, PyObject **args, Py_ssize_t nargs, PyObje
PyObject *return_value = NULL;
PyObject *group = NULL;
- if (!_PyArg_UnpackStack(args, nargs, "span",
- 0, 1,
- &group)) {
+ if (!_PyArg_NoStackKeywords("span", kwnames)) {
goto exit;
}
- if (!_PyArg_NoStackKeywords("span", kwnames)) {
+ if (!_PyArg_UnpackStack(args, nargs, "span",
+ 0, 1,
+ &group)) {
goto exit;
}
return_value = _sre_SRE_Match_span_impl(self, group);
@@ -777,4 +777,4 @@ _sre_SRE_Scanner_search(ScannerObject *self, PyObject *Py_UNUSED(ignored))
{
return _sre_SRE_Scanner_search_impl(self);
}
-/*[clinic end generated code: output=5fe47c49e475cccb input=a9049054013a1b77]*/
+/*[clinic end generated code: output=28b0cc05da4ac219 input=a9049054013a1b77]*/