diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-03-19 08:46:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-19 08:46:44 +0200 |
commit | 5c643a028ee86c613d7168ca5bcb8fc94477a09e (patch) | |
tree | 6a1ba2f0a2b0c75486c2ca84a4689f6ddd181628 /Objects/clinic | |
parent | bdf6b910f9ea75609caee498a975af03b6d23f67 (diff) | |
download | cpython-git-5c643a028ee86c613d7168ca5bcb8fc94477a09e.tar.gz |
bpo-20185: Convert typeobject.c to Argument Clinic. (#544)
Based on patch by Vajrasky Kok.
Diffstat (limited to 'Objects/clinic')
-rw-r--r-- | Objects/clinic/typeobject.c.h | 259 |
1 files changed, 259 insertions, 0 deletions
diff --git a/Objects/clinic/typeobject.c.h b/Objects/clinic/typeobject.c.h new file mode 100644 index 0000000000..1b19ccf061 --- /dev/null +++ b/Objects/clinic/typeobject.c.h @@ -0,0 +1,259 @@ +/*[clinic input] +preserve +[clinic start generated code]*/ + +PyDoc_STRVAR(type___instancecheck____doc__, +"__instancecheck__($self, instance, /)\n" +"--\n" +"\n" +"Check if an object is an instance."); + +#define TYPE___INSTANCECHECK___METHODDEF \ + {"__instancecheck__", (PyCFunction)type___instancecheck__, METH_O, type___instancecheck____doc__}, + +static int +type___instancecheck___impl(PyTypeObject *self, PyObject *instance); + +static PyObject * +type___instancecheck__(PyTypeObject *self, PyObject *instance) +{ + PyObject *return_value = NULL; + int _return_value; + + _return_value = type___instancecheck___impl(self, instance); + if ((_return_value == -1) && PyErr_Occurred()) { + goto exit; + } + return_value = PyBool_FromLong((long)_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(type___subclasscheck____doc__, +"__subclasscheck__($self, subclass, /)\n" +"--\n" +"\n" +"Check if a class is a subclass."); + +#define TYPE___SUBCLASSCHECK___METHODDEF \ + {"__subclasscheck__", (PyCFunction)type___subclasscheck__, METH_O, type___subclasscheck____doc__}, + +static int +type___subclasscheck___impl(PyTypeObject *self, PyObject *subclass); + +static PyObject * +type___subclasscheck__(PyTypeObject *self, PyObject *subclass) +{ + PyObject *return_value = NULL; + int _return_value; + + _return_value = type___subclasscheck___impl(self, subclass); + if ((_return_value == -1) && PyErr_Occurred()) { + goto exit; + } + return_value = PyBool_FromLong((long)_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(type_mro__doc__, +"mro($self, /)\n" +"--\n" +"\n" +"Return a type\'s method resolution order."); + +#define TYPE_MRO_METHODDEF \ + {"mro", (PyCFunction)type_mro, METH_NOARGS, type_mro__doc__}, + +static PyObject * +type_mro_impl(PyTypeObject *self); + +static PyObject * +type_mro(PyTypeObject *self, PyObject *Py_UNUSED(ignored)) +{ + return type_mro_impl(self); +} + +PyDoc_STRVAR(type___subclasses____doc__, +"__subclasses__($self, /)\n" +"--\n" +"\n" +"Return a list of immediate subclasses."); + +#define TYPE___SUBCLASSES___METHODDEF \ + {"__subclasses__", (PyCFunction)type___subclasses__, METH_NOARGS, type___subclasses____doc__}, + +static PyObject * +type___subclasses___impl(PyTypeObject *self); + +static PyObject * +type___subclasses__(PyTypeObject *self, PyObject *Py_UNUSED(ignored)) +{ + return type___subclasses___impl(self); +} + +PyDoc_STRVAR(type___dir____doc__, +"__dir__($self, /)\n" +"--\n" +"\n" +"Specialized __dir__ implementation for types."); + +#define TYPE___DIR___METHODDEF \ + {"__dir__", (PyCFunction)type___dir__, METH_NOARGS, type___dir____doc__}, + +static PyObject * +type___dir___impl(PyTypeObject *self); + +static PyObject * +type___dir__(PyTypeObject *self, PyObject *Py_UNUSED(ignored)) +{ + return type___dir___impl(self); +} + +PyDoc_STRVAR(type___sizeof____doc__, +"__sizeof__($self, /)\n" +"--\n" +"\n" +"Return memory consumption of the type object."); + +#define TYPE___SIZEOF___METHODDEF \ + {"__sizeof__", (PyCFunction)type___sizeof__, METH_NOARGS, type___sizeof____doc__}, + +static PyObject * +type___sizeof___impl(PyTypeObject *self); + +static PyObject * +type___sizeof__(PyTypeObject *self, PyObject *Py_UNUSED(ignored)) +{ + return type___sizeof___impl(self); +} + +PyDoc_STRVAR(object___reduce____doc__, +"__reduce__($self, protocol=0, /)\n" +"--\n" +"\n" +"Helper for pickle."); + +#define OBJECT___REDUCE___METHODDEF \ + {"__reduce__", (PyCFunction)object___reduce__, METH_FASTCALL, object___reduce____doc__}, + +static PyObject * +object___reduce___impl(PyObject *self, int protocol); + +static PyObject * +object___reduce__(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + int protocol = 0; + + if (!_PyArg_ParseStack(args, nargs, "|i:__reduce__", + &protocol)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("__reduce__", kwnames)) { + goto exit; + } + return_value = object___reduce___impl(self, protocol); + +exit: + return return_value; +} + +PyDoc_STRVAR(object___reduce_ex____doc__, +"__reduce_ex__($self, protocol=0, /)\n" +"--\n" +"\n" +"Helper for pickle."); + +#define OBJECT___REDUCE_EX___METHODDEF \ + {"__reduce_ex__", (PyCFunction)object___reduce_ex__, METH_FASTCALL, object___reduce_ex____doc__}, + +static PyObject * +object___reduce_ex___impl(PyObject *self, int protocol); + +static PyObject * +object___reduce_ex__(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + int protocol = 0; + + if (!_PyArg_ParseStack(args, nargs, "|i:__reduce_ex__", + &protocol)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("__reduce_ex__", kwnames)) { + goto exit; + } + return_value = object___reduce_ex___impl(self, protocol); + +exit: + return return_value; +} + +PyDoc_STRVAR(object___format____doc__, +"__format__($self, format_spec, /)\n" +"--\n" +"\n" +"Default object formatter."); + +#define OBJECT___FORMAT___METHODDEF \ + {"__format__", (PyCFunction)object___format__, METH_O, object___format____doc__}, + +static PyObject * +object___format___impl(PyObject *self, PyObject *format_spec); + +static PyObject * +object___format__(PyObject *self, PyObject *arg) +{ + PyObject *return_value = NULL; + PyObject *format_spec; + + if (!PyArg_Parse(arg, "U:__format__", &format_spec)) { + goto exit; + } + return_value = object___format___impl(self, format_spec); + +exit: + return return_value; +} + +PyDoc_STRVAR(object___sizeof____doc__, +"__sizeof__($self, /)\n" +"--\n" +"\n" +"Size of object in memory, in bytes."); + +#define OBJECT___SIZEOF___METHODDEF \ + {"__sizeof__", (PyCFunction)object___sizeof__, METH_NOARGS, object___sizeof____doc__}, + +static PyObject * +object___sizeof___impl(PyObject *self); + +static PyObject * +object___sizeof__(PyObject *self, PyObject *Py_UNUSED(ignored)) +{ + return object___sizeof___impl(self); +} + +PyDoc_STRVAR(object___dir____doc__, +"__dir__($self, /)\n" +"--\n" +"\n" +"Default dir() implementation."); + +#define OBJECT___DIR___METHODDEF \ + {"__dir__", (PyCFunction)object___dir__, METH_NOARGS, object___dir____doc__}, + +static PyObject * +object___dir___impl(PyObject *self); + +static PyObject * +object___dir__(PyObject *self, PyObject *Py_UNUSED(ignored)) +{ + return object___dir___impl(self); +} +/*[clinic end generated code: output=ce354e436e2360a0 input=a9049054013a1b77]*/ |