summaryrefslogtreecommitdiff
path: root/Objects/clinic
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-01-17 02:21:47 +0100
committerVictor Stinner <victor.stinner@gmail.com>2017-01-17 02:21:47 +0100
commit0c4a828cadfccd8b95a39f7930705de75ed5f729 (patch)
tree713eeceb5c63f4324fa83e9603a0284272e9eb58 /Objects/clinic
parent093119e4eb8424451ef24a5a5a3ce9881d77abd5 (diff)
downloadcpython-git-0c4a828cadfccd8b95a39f7930705de75ed5f729.tar.gz
Run Argument Clinic: METH_VARARGS=>METH_FASTCALL
Issue #29286. Run Argument Clinic to get the new faster METH_FASTCALL calling convention for functions using "boring" positional arguments. Manually fix _elementtree: _elementtree_XMLParser_doctype() must remain consistent with the clinic code.
Diffstat (limited to 'Objects/clinic')
-rw-r--r--Objects/clinic/bytearrayobject.c.h32
-rw-r--r--Objects/clinic/bytesobject.c.h32
-rw-r--r--Objects/clinic/dictobject.c.h12
-rw-r--r--Objects/clinic/unicodeobject.c.h34
4 files changed, 75 insertions, 35 deletions
diff --git a/Objects/clinic/bytearrayobject.c.h b/Objects/clinic/bytearrayobject.c.h
index 3e39e9a7bd..a181d9a99b 100644
--- a/Objects/clinic/bytearrayobject.c.h
+++ b/Objects/clinic/bytearrayobject.c.h
@@ -463,22 +463,26 @@ PyDoc_STRVAR(bytearray_strip__doc__,
"If the argument is omitted or None, strip leading and trailing ASCII whitespace.");
#define BYTEARRAY_STRIP_METHODDEF \
- {"strip", (PyCFunction)bytearray_strip, METH_VARARGS, bytearray_strip__doc__},
+ {"strip", (PyCFunction)bytearray_strip, METH_FASTCALL, bytearray_strip__doc__},
static PyObject *
bytearray_strip_impl(PyByteArrayObject *self, PyObject *bytes);
static PyObject *
-bytearray_strip(PyByteArrayObject *self, PyObject *args)
+bytearray_strip(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *bytes = Py_None;
- if (!PyArg_UnpackTuple(args, "strip",
+ if (!_PyArg_UnpackStack(args, nargs, "strip",
0, 1,
&bytes)) {
goto exit;
}
+
+ if (!_PyArg_NoStackKeywords("strip", kwnames)) {
+ goto exit;
+ }
return_value = bytearray_strip_impl(self, bytes);
exit:
@@ -494,22 +498,26 @@ PyDoc_STRVAR(bytearray_lstrip__doc__,
"If the argument is omitted or None, strip leading ASCII whitespace.");
#define BYTEARRAY_LSTRIP_METHODDEF \
- {"lstrip", (PyCFunction)bytearray_lstrip, METH_VARARGS, bytearray_lstrip__doc__},
+ {"lstrip", (PyCFunction)bytearray_lstrip, METH_FASTCALL, bytearray_lstrip__doc__},
static PyObject *
bytearray_lstrip_impl(PyByteArrayObject *self, PyObject *bytes);
static PyObject *
-bytearray_lstrip(PyByteArrayObject *self, PyObject *args)
+bytearray_lstrip(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *bytes = Py_None;
- if (!PyArg_UnpackTuple(args, "lstrip",
+ if (!_PyArg_UnpackStack(args, nargs, "lstrip",
0, 1,
&bytes)) {
goto exit;
}
+
+ if (!_PyArg_NoStackKeywords("lstrip", kwnames)) {
+ goto exit;
+ }
return_value = bytearray_lstrip_impl(self, bytes);
exit:
@@ -525,22 +533,26 @@ PyDoc_STRVAR(bytearray_rstrip__doc__,
"If the argument is omitted or None, strip trailing ASCII whitespace.");
#define BYTEARRAY_RSTRIP_METHODDEF \
- {"rstrip", (PyCFunction)bytearray_rstrip, METH_VARARGS, bytearray_rstrip__doc__},
+ {"rstrip", (PyCFunction)bytearray_rstrip, METH_FASTCALL, bytearray_rstrip__doc__},
static PyObject *
bytearray_rstrip_impl(PyByteArrayObject *self, PyObject *bytes);
static PyObject *
-bytearray_rstrip(PyByteArrayObject *self, PyObject *args)
+bytearray_rstrip(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *bytes = Py_None;
- if (!PyArg_UnpackTuple(args, "rstrip",
+ if (!_PyArg_UnpackStack(args, nargs, "rstrip",
0, 1,
&bytes)) {
goto exit;
}
+
+ if (!_PyArg_NoStackKeywords("rstrip", kwnames)) {
+ goto exit;
+ }
return_value = bytearray_rstrip_impl(self, bytes);
exit:
@@ -731,4 +743,4 @@ bytearray_sizeof(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored))
{
return bytearray_sizeof_impl(self);
}
-/*[clinic end generated code: output=e6c057d1cd7c2496 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=f5c364927425fae8 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/bytesobject.c.h b/Objects/clinic/bytesobject.c.h
index 330cb84853..c73b56023d 100644
--- a/Objects/clinic/bytesobject.c.h
+++ b/Objects/clinic/bytesobject.c.h
@@ -184,22 +184,26 @@ PyDoc_STRVAR(bytes_strip__doc__,
"If the argument is omitted or None, strip leading and trailing ASCII whitespace.");
#define BYTES_STRIP_METHODDEF \
- {"strip", (PyCFunction)bytes_strip, METH_VARARGS, bytes_strip__doc__},
+ {"strip", (PyCFunction)bytes_strip, METH_FASTCALL, bytes_strip__doc__},
static PyObject *
bytes_strip_impl(PyBytesObject *self, PyObject *bytes);
static PyObject *
-bytes_strip(PyBytesObject *self, PyObject *args)
+bytes_strip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *bytes = Py_None;
- if (!PyArg_UnpackTuple(args, "strip",
+ if (!_PyArg_UnpackStack(args, nargs, "strip",
0, 1,
&bytes)) {
goto exit;
}
+
+ if (!_PyArg_NoStackKeywords("strip", kwnames)) {
+ goto exit;
+ }
return_value = bytes_strip_impl(self, bytes);
exit:
@@ -215,22 +219,26 @@ PyDoc_STRVAR(bytes_lstrip__doc__,
"If the argument is omitted or None, strip leading ASCII whitespace.");
#define BYTES_LSTRIP_METHODDEF \
- {"lstrip", (PyCFunction)bytes_lstrip, METH_VARARGS, bytes_lstrip__doc__},
+ {"lstrip", (PyCFunction)bytes_lstrip, METH_FASTCALL, bytes_lstrip__doc__},
static PyObject *
bytes_lstrip_impl(PyBytesObject *self, PyObject *bytes);
static PyObject *
-bytes_lstrip(PyBytesObject *self, PyObject *args)
+bytes_lstrip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *bytes = Py_None;
- if (!PyArg_UnpackTuple(args, "lstrip",
+ if (!_PyArg_UnpackStack(args, nargs, "lstrip",
0, 1,
&bytes)) {
goto exit;
}
+
+ if (!_PyArg_NoStackKeywords("lstrip", kwnames)) {
+ goto exit;
+ }
return_value = bytes_lstrip_impl(self, bytes);
exit:
@@ -246,22 +254,26 @@ PyDoc_STRVAR(bytes_rstrip__doc__,
"If the argument is omitted or None, strip trailing ASCII whitespace.");
#define BYTES_RSTRIP_METHODDEF \
- {"rstrip", (PyCFunction)bytes_rstrip, METH_VARARGS, bytes_rstrip__doc__},
+ {"rstrip", (PyCFunction)bytes_rstrip, METH_FASTCALL, bytes_rstrip__doc__},
static PyObject *
bytes_rstrip_impl(PyBytesObject *self, PyObject *bytes);
static PyObject *
-bytes_rstrip(PyBytesObject *self, PyObject *args)
+bytes_rstrip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *bytes = Py_None;
- if (!PyArg_UnpackTuple(args, "rstrip",
+ if (!_PyArg_UnpackStack(args, nargs, "rstrip",
0, 1,
&bytes)) {
goto exit;
}
+
+ if (!_PyArg_NoStackKeywords("rstrip", kwnames)) {
+ goto exit;
+ }
return_value = bytes_rstrip_impl(self, bytes);
exit:
@@ -507,4 +519,4 @@ bytes_fromhex(PyTypeObject *type, PyObject *arg)
exit:
return return_value;
}
-/*[clinic end generated code: output=2b8d3cff7e11045e input=a9049054013a1b77]*/
+/*[clinic end generated code: output=2504c1225108d348 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/dictobject.c.h b/Objects/clinic/dictobject.c.h
index d0cdfc3eda..3f06c0b5da 100644
--- a/Objects/clinic/dictobject.c.h
+++ b/Objects/clinic/dictobject.c.h
@@ -9,23 +9,27 @@ PyDoc_STRVAR(dict_fromkeys__doc__,
"Returns a new dict with keys from iterable and values equal to value.");
#define DICT_FROMKEYS_METHODDEF \
- {"fromkeys", (PyCFunction)dict_fromkeys, METH_VARARGS|METH_CLASS, dict_fromkeys__doc__},
+ {"fromkeys", (PyCFunction)dict_fromkeys, METH_FASTCALL|METH_CLASS, dict_fromkeys__doc__},
static PyObject *
dict_fromkeys_impl(PyTypeObject *type, PyObject *iterable, PyObject *value);
static PyObject *
-dict_fromkeys(PyTypeObject *type, PyObject *args)
+dict_fromkeys(PyTypeObject *type, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *iterable;
PyObject *value = Py_None;
- if (!PyArg_UnpackTuple(args, "fromkeys",
+ if (!_PyArg_UnpackStack(args, nargs, "fromkeys",
1, 2,
&iterable, &value)) {
goto exit;
}
+
+ if (!_PyArg_NoStackKeywords("fromkeys", kwnames)) {
+ goto exit;
+ }
return_value = dict_fromkeys_impl(type, iterable, value);
exit:
@@ -40,4 +44,4 @@ PyDoc_STRVAR(dict___contains____doc__,
#define DICT___CONTAINS___METHODDEF \
{"__contains__", (PyCFunction)dict___contains__, METH_O|METH_COEXIST, dict___contains____doc__},
-/*[clinic end generated code: output=926326109e3d9839 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=69f3d767ed44e8ec input=a9049054013a1b77]*/
diff --git a/Objects/clinic/unicodeobject.c.h b/Objects/clinic/unicodeobject.c.h
index d968cbe346..c4bf3a433c 100644
--- a/Objects/clinic/unicodeobject.c.h
+++ b/Objects/clinic/unicodeobject.c.h
@@ -471,27 +471,31 @@ PyDoc_STRVAR(unicode_strip__doc__,
"strip($self, chars=None, /)\n"
"--\n"
"\n"
-"Return a copy of the string with leading and trailing whitespace removed.\n"
+"Return a copy of the string with leading and trailing whitespace remove.\n"
"\n"
"If chars is given and not None, remove characters in chars instead.");
#define UNICODE_STRIP_METHODDEF \
- {"strip", (PyCFunction)unicode_strip, METH_VARARGS, unicode_strip__doc__},
+ {"strip", (PyCFunction)unicode_strip, METH_FASTCALL, unicode_strip__doc__},
static PyObject *
unicode_strip_impl(PyObject *self, PyObject *chars);
static PyObject *
-unicode_strip(PyObject *self, PyObject *args)
+unicode_strip(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *chars = Py_None;
- if (!PyArg_UnpackTuple(args, "strip",
+ if (!_PyArg_UnpackStack(args, nargs, "strip",
0, 1,
&chars)) {
goto exit;
}
+
+ if (!_PyArg_NoStackKeywords("strip", kwnames)) {
+ goto exit;
+ }
return_value = unicode_strip_impl(self, chars);
exit:
@@ -507,22 +511,26 @@ PyDoc_STRVAR(unicode_lstrip__doc__,
"If chars is given and not None, remove characters in chars instead.");
#define UNICODE_LSTRIP_METHODDEF \
- {"lstrip", (PyCFunction)unicode_lstrip, METH_VARARGS, unicode_lstrip__doc__},
+ {"lstrip", (PyCFunction)unicode_lstrip, METH_FASTCALL, unicode_lstrip__doc__},
static PyObject *
unicode_lstrip_impl(PyObject *self, PyObject *chars);
static PyObject *
-unicode_lstrip(PyObject *self, PyObject *args)
+unicode_lstrip(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *chars = NULL;
- if (!PyArg_UnpackTuple(args, "lstrip",
+ if (!_PyArg_UnpackStack(args, nargs, "lstrip",
0, 1,
&chars)) {
goto exit;
}
+
+ if (!_PyArg_NoStackKeywords("lstrip", kwnames)) {
+ goto exit;
+ }
return_value = unicode_lstrip_impl(self, chars);
exit:
@@ -538,22 +546,26 @@ PyDoc_STRVAR(unicode_rstrip__doc__,
"If chars is given and not None, remove characters in chars instead.");
#define UNICODE_RSTRIP_METHODDEF \
- {"rstrip", (PyCFunction)unicode_rstrip, METH_VARARGS, unicode_rstrip__doc__},
+ {"rstrip", (PyCFunction)unicode_rstrip, METH_FASTCALL, unicode_rstrip__doc__},
static PyObject *
unicode_rstrip_impl(PyObject *self, PyObject *chars);
static PyObject *
-unicode_rstrip(PyObject *self, PyObject *args)
+unicode_rstrip(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *chars = NULL;
- if (!PyArg_UnpackTuple(args, "rstrip",
+ if (!_PyArg_UnpackStack(args, nargs, "rstrip",
0, 1,
&chars)) {
goto exit;
}
+
+ if (!_PyArg_NoStackKeywords("rstrip", kwnames)) {
+ goto exit;
+ }
return_value = unicode_rstrip_impl(self, chars);
exit:
@@ -950,4 +962,4 @@ unicode_sizeof(PyObject *self, PyObject *Py_UNUSED(ignored))
{
return unicode_sizeof_impl(self);
}
-/*[clinic end generated code: output=eb6a3ae361a1a379 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=3d73f3dfd6ec7d83 input=a9049054013a1b77]*/