summaryrefslogtreecommitdiffstats
path: root/Python/bltinmodule.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-04-03 20:53:51 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-04-03 20:53:51 (GMT)
commit1009bf18b38a8d36298575191dd8fdf43f8f9097 (patch)
tree18860fdef30c931dc2ea177059e96b69a49fa04f /Python/bltinmodule.c
parent0759f84d6260bad1234b802212e73fdc5873d261 (diff)
downloadcpython-1009bf18b38a8d36298575191dd8fdf43f8f9097.zip
cpython-1009bf18b38a8d36298575191dd8fdf43f8f9097.tar.gz
cpython-1009bf18b38a8d36298575191dd8fdf43f8f9097.tar.bz2
Issue #23501: Argumen Clinic now generates code into separate files by default.
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r--Python/bltinmodule.c715
1 files changed, 31 insertions, 684 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 4f61d1e..e733485 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -46,6 +46,8 @@ _Py_IDENTIFIER(stdin);
_Py_IDENTIFIER(stdout);
_Py_IDENTIFIER(stderr);
+#include "clinic/bltinmodule.c.h"
+
/* AC: cannot convert yet, waiting for *args support */
static PyObject *
builtin___build_class__(PyObject *self, PyObject *args, PyObject *kwds)
@@ -239,18 +241,9 @@ abs as builtin_abs
Return the absolute value of the argument.
[clinic start generated code]*/
-PyDoc_STRVAR(builtin_abs__doc__,
-"abs($module, x, /)\n"
-"--\n"
-"\n"
-"Return the absolute value of the argument.");
-
-#define BUILTIN_ABS_METHODDEF \
- {"abs", (PyCFunction)builtin_abs, METH_O, builtin_abs__doc__},
-
static PyObject *
builtin_abs(PyModuleDef *module, PyObject *x)
-/*[clinic end generated code: output=f85095528ce7e2e5 input=aa29cc07869b4732]*/
+/*[clinic end generated code: output=6833047c493ecea2 input=aa29cc07869b4732]*/
{
return PyNumber_Absolute(x);
}
@@ -266,20 +259,9 @@ Return True if bool(x) is True for all values x in the iterable.
If the iterable is empty, return True.
[clinic start generated code]*/
-PyDoc_STRVAR(builtin_all__doc__,
-"all($module, iterable, /)\n"
-"--\n"
-"\n"
-"Return True if bool(x) is True for all values x in the iterable.\n"
-"\n"
-"If the iterable is empty, return True.");
-
-#define BUILTIN_ALL_METHODDEF \
- {"all", (PyCFunction)builtin_all, METH_O, builtin_all__doc__},
-
static PyObject *
builtin_all(PyModuleDef *module, PyObject *iterable)
-/*[clinic end generated code: output=d001db739ba83b46 input=dd506dc9998d42bd]*/
+/*[clinic end generated code: output=089e6d1b7bde27b1 input=dd506dc9998d42bd]*/
{
PyObject *it, *item;
PyObject *(*iternext)(PyObject *);
@@ -326,20 +308,9 @@ Return True if bool(x) is True for any x in the iterable.
If the iterable is empty, return False.
[clinic start generated code]*/
-PyDoc_STRVAR(builtin_any__doc__,
-"any($module, iterable, /)\n"
-"--\n"
-"\n"
-"Return True if bool(x) is True for any x in the iterable.\n"
-"\n"
-"If the iterable is empty, return False.");
-
-#define BUILTIN_ANY_METHODDEF \
- {"any", (PyCFunction)builtin_any, METH_O, builtin_any__doc__},
-
static PyObject *
builtin_any(PyModuleDef *module, PyObject *iterable)
-/*[clinic end generated code: output=3a4b6dbe6a0d6f61 input=8fe8460f3fbbced8]*/
+/*[clinic end generated code: output=1be994b2c2307492 input=8fe8460f3fbbced8]*/
{
PyObject *it, *item;
PyObject *(*iternext)(PyObject *);
@@ -389,23 +360,9 @@ repr() using \\x, \\u or \\U escapes. This generates a string similar
to that returned by repr() in Python 2.
[clinic start generated code]*/
-PyDoc_STRVAR(builtin_ascii__doc__,
-"ascii($module, obj, /)\n"
-"--\n"
-"\n"
-"Return an ASCII-only representation of an object.\n"
-"\n"
-"As repr(), return a string containing a printable representation of an\n"
-"object, but escape the non-ASCII characters in the string returned by\n"
-"repr() using \\\\x, \\\\u or \\\\U escapes. This generates a string similar\n"
-"to that returned by repr() in Python 2.");
-
-#define BUILTIN_ASCII_METHODDEF \
- {"ascii", (PyCFunction)builtin_ascii, METH_O, builtin_ascii__doc__},
-
static PyObject *
builtin_ascii(PyModuleDef *module, PyObject *obj)
-/*[clinic end generated code: output=f0e6754154c2d30b input=0cbdc1420a306325]*/
+/*[clinic end generated code: output=d4e862c48af2a933 input=0cbdc1420a306325]*/
{
return PyObject_ASCII(obj);
}
@@ -423,21 +380,9 @@ Return the binary representation of an integer.
'0b1010101010101010101010'
[clinic start generated code]*/
-PyDoc_STRVAR(builtin_bin__doc__,
-"bin($module, number, /)\n"
-"--\n"
-"\n"
-"Return the binary representation of an integer.\n"
-"\n"
-" >>> bin(2796202)\n"
-" \'0b1010101010101010101010\'");
-
-#define BUILTIN_BIN_METHODDEF \
- {"bin", (PyCFunction)builtin_bin, METH_O, builtin_bin__doc__},
-
static PyObject *
builtin_bin(PyModuleDef *module, PyObject *number)
-/*[clinic end generated code: output=18fed0e943650da1 input=2a6362ae9a9c9203]*/
+/*[clinic end generated code: output=25ee26c6cf3bbb54 input=2a6362ae9a9c9203]*/
{
return PyNumber_ToBase(number, 2);
}
@@ -455,21 +400,9 @@ Note that classes are callable, as are instances of classes with a
__call__() method.
[clinic start generated code]*/
-PyDoc_STRVAR(builtin_callable__doc__,
-"callable($module, obj, /)\n"
-"--\n"
-"\n"
-"Return whether the object is callable (i.e., some kind of function).\n"
-"\n"
-"Note that classes are callable, as are instances of classes with a\n"
-"__call__() method.");
-
-#define BUILTIN_CALLABLE_METHODDEF \
- {"callable", (PyCFunction)builtin_callable, METH_O, builtin_callable__doc__},
-
static PyObject *
builtin_callable(PyModuleDef *module, PyObject *obj)
-/*[clinic end generated code: output=b3a92cbe635f32af input=bb3bb528fffdade4]*/
+/*[clinic end generated code: output=f4df2ce92364b656 input=bb3bb528fffdade4]*/
{
return PyBool_FromLong((long)PyCallable_Check(obj));
}
@@ -640,40 +573,9 @@ Return value.__format__(format_spec)
format_spec defaults to the empty string
[clinic start generated code]*/
-PyDoc_STRVAR(builtin_format__doc__,
-"format($module, value, format_spec=\'\', /)\n"
-"--\n"
-"\n"
-"Return value.__format__(format_spec)\n"
-"\n"
-"format_spec defaults to the empty string");
-
-#define BUILTIN_FORMAT_METHODDEF \
- {"format", (PyCFunction)builtin_format, METH_VARARGS, builtin_format__doc__},
-
-static PyObject *
-builtin_format_impl(PyModuleDef *module, PyObject *value, PyObject *format_spec);
-
-static PyObject *
-builtin_format(PyModuleDef *module, PyObject *args)
-{
- PyObject *return_value = NULL;
- PyObject *value;
- PyObject *format_spec = NULL;
-
- if (!PyArg_ParseTuple(args,
- "O|U:format",
- &value, &format_spec))
- goto exit;
- return_value = builtin_format_impl(module, value, format_spec);
-
-exit:
- return return_value;
-}
-
static PyObject *
builtin_format_impl(PyModuleDef *module, PyObject *value, PyObject *format_spec)
-/*[clinic end generated code: output=39723a58c72e8871 input=e23f2f11e0098c64]*/
+/*[clinic end generated code: output=fae3e927cc715466 input=e23f2f11e0098c64]*/
{
return PyObject_Format(value, format_spec);
}
@@ -687,37 +589,9 @@ chr as builtin_chr
Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff.
[clinic start generated code]*/
-PyDoc_STRVAR(builtin_chr__doc__,
-"chr($module, i, /)\n"
-"--\n"
-"\n"
-"Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff.");
-
-#define BUILTIN_CHR_METHODDEF \
- {"chr", (PyCFunction)builtin_chr, METH_VARARGS, builtin_chr__doc__},
-
-static PyObject *
-builtin_chr_impl(PyModuleDef *module, int i);
-
-static PyObject *
-builtin_chr(PyModuleDef *module, PyObject *args)
-{
- PyObject *return_value = NULL;
- int i;
-
- if (!PyArg_ParseTuple(args,
- "i:chr",
- &i))
- goto exit;
- return_value = builtin_chr_impl(module, i);
-
-exit:
- return return_value;
-}
-
static PyObject *
builtin_chr_impl(PyModuleDef *module, int i)
-/*[clinic end generated code: output=4d6bbe948f56e2ae input=9b1ced29615adf66]*/
+/*[clinic end generated code: output=67fe4d87e690f373 input=9b1ced29615adf66]*/
{
return PyUnicode_FromOrdinal(i);
}
@@ -779,55 +653,9 @@ compile; if absent or zero these statements do influence the compilation,
in addition to any features explicitly specified.
[clinic start generated code]*/
-PyDoc_STRVAR(builtin_compile__doc__,
-"compile($module, /, source, filename, mode, flags=0, dont_inherit=0,\n"
-" optimize=-1)\n"
-"--\n"
-"\n"
-"Compile source into a code object that can be executed by exec() or eval().\n"
-"\n"
-"The source code may represent a Python module, statement or expression.\n"
-"The filename will be used for run-time error messages.\n"
-"The mode must be \'exec\' to compile a module, \'single\' to compile a\n"
-"single (interactive) statement, or \'eval\' to compile an expression.\n"
-"The flags argument, if present, controls which future statements influence\n"
-"the compilation of the code.\n"
-"The dont_inherit argument, if non-zero, stops the compilation inheriting\n"
-"the effects of any future statements in effect in the code calling\n"
-"compile; if absent or zero these statements do influence the compilation,\n"
-"in addition to any features explicitly specified.");
-
-#define BUILTIN_COMPILE_METHODDEF \
- {"compile", (PyCFunction)builtin_compile, METH_VARARGS|METH_KEYWORDS, builtin_compile__doc__},
-
-static PyObject *
-builtin_compile_impl(PyModuleDef *module, PyObject *source, PyObject *filename, const char *mode, int flags, int dont_inherit, int optimize);
-
-static PyObject *
-builtin_compile(PyModuleDef *module, PyObject *args, PyObject *kwargs)
-{
- PyObject *return_value = NULL;
- static char *_keywords[] = {"source", "filename", "mode", "flags", "dont_inherit", "optimize", NULL};
- PyObject *source;
- PyObject *filename;
- const char *mode;
- int flags = 0;
- int dont_inherit = 0;
- int optimize = -1;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwargs,
- "OO&s|iii:compile", _keywords,
- &source, PyUnicode_FSDecoder, &filename, &mode, &flags, &dont_inherit, &optimize))
- goto exit;
- return_value = builtin_compile_impl(module, source, filename, mode, flags, dont_inherit, optimize);
-
-exit:
- return return_value;
-}
-
static PyObject *
builtin_compile_impl(PyModuleDef *module, PyObject *source, PyObject *filename, const char *mode, int flags, int dont_inherit, int optimize)
-/*[clinic end generated code: output=c72d197809d178fc input=c6212a9d21472f7e]*/
+/*[clinic end generated code: output=4f41a315386bab9f input=c6212a9d21472f7e]*/
{
Py_buffer view = {NULL, NULL};
const char *str;
@@ -951,38 +779,9 @@ divmod as builtin_divmod
Return the tuple ((x-x%y)/y, x%y). Invariant: div*y + mod == x.
[clinic start generated code]*/
-PyDoc_STRVAR(builtin_divmod__doc__,
-"divmod($module, x, y, /)\n"
-"--\n"
-"\n"
-"Return the tuple ((x-x%y)/y, x%y). Invariant: div*y + mod == x.");
-
-#define BUILTIN_DIVMOD_METHODDEF \
- {"divmod", (PyCFunction)builtin_divmod, METH_VARARGS, builtin_divmod__doc__},
-
-static PyObject *
-builtin_divmod_impl(PyModuleDef *module, PyObject *x, PyObject *y);
-
-static PyObject *
-builtin_divmod(PyModuleDef *module, PyObject *args)
-{
- PyObject *return_value = NULL;
- PyObject *x;
- PyObject *y;
-
- if (!PyArg_UnpackTuple(args, "divmod",
- 2, 2,
- &x, &y))
- goto exit;
- return_value = builtin_divmod_impl(module, x, y);
-
-exit:
- return return_value;
-}
-
static PyObject *
builtin_divmod_impl(PyModuleDef *module, PyObject *x, PyObject *y)
-/*[clinic end generated code: output=77e8d408b1338886 input=c9c617b7bb74c615]*/
+/*[clinic end generated code: output=9ad0076120ebf9ac input=c9c617b7bb74c615]*/
{
return PyNumber_Divmod(x, y);
}
@@ -1005,45 +804,9 @@ defaulting to the current globals and locals.
If only globals is given, locals defaults to it.
[clinic start generated code]*/
-PyDoc_STRVAR(builtin_eval__doc__,
-"eval($module, source, globals=None, locals=None, /)\n"
-"--\n"
-"\n"
-"Evaluate the given source in the context of globals and locals.\n"
-"\n"
-"The source may be a string representing a Python expression\n"
-"or a code object as returned by compile().\n"
-"The globals must be a dictionary and locals can be any mapping,\n"
-"defaulting to the current globals and locals.\n"
-"If only globals is given, locals defaults to it.");
-
-#define BUILTIN_EVAL_METHODDEF \
- {"eval", (PyCFunction)builtin_eval, METH_VARARGS, builtin_eval__doc__},
-
-static PyObject *
-builtin_eval_impl(PyModuleDef *module, PyObject *source, PyObject *globals, PyObject *locals);
-
-static PyObject *
-builtin_eval(PyModuleDef *module, PyObject *args)
-{
- PyObject *return_value = NULL;
- PyObject *source;
- PyObject *globals = Py_None;
- PyObject *locals = Py_None;
-
- if (!PyArg_UnpackTuple(args, "eval",
- 1, 3,
- &source, &globals, &locals))
- goto exit;
- return_value = builtin_eval_impl(module, source, globals, locals);
-
-exit:
- return return_value;
-}
-
static PyObject *
builtin_eval_impl(PyModuleDef *module, PyObject *source, PyObject *globals, PyObject *locals)
-/*[clinic end generated code: output=644fd59012538ce6 input=31e42c1d2125b50b]*/
+/*[clinic end generated code: output=90642b79dd8b08d6 input=31e42c1d2125b50b]*/
{
PyObject *result, *tmp = NULL;
Py_buffer view = {NULL, NULL};
@@ -1125,45 +888,9 @@ defaulting to the current globals and locals.
If only globals is given, locals defaults to it.
[clinic start generated code]*/
-PyDoc_STRVAR(builtin_exec__doc__,
-"exec($module, source, globals=None, locals=None, /)\n"
-"--\n"
-"\n"
-"Execute the given source in the context of globals and locals.\n"
-"\n"
-"The source may be a string representing one or more Python statements\n"
-"or a code object as returned by compile().\n"
-"The globals must be a dictionary and locals can be any mapping,\n"
-"defaulting to the current globals and locals.\n"
-"If only globals is given, locals defaults to it.");
-
-#define BUILTIN_EXEC_METHODDEF \
- {"exec", (PyCFunction)builtin_exec, METH_VARARGS, builtin_exec__doc__},
-
-static PyObject *
-builtin_exec_impl(PyModuleDef *module, PyObject *source, PyObject *globals, PyObject *locals);
-
-static PyObject *
-builtin_exec(PyModuleDef *module, PyObject *args)
-{
- PyObject *return_value = NULL;
- PyObject *source;
- PyObject *globals = Py_None;
- PyObject *locals = Py_None;
-
- if (!PyArg_UnpackTuple(args, "exec",
- 1, 3,
- &source, &globals, &locals))
- goto exit;
- return_value = builtin_exec_impl(module, source, globals, locals);
-
-exit:
- return return_value;
-}
-
static PyObject *
builtin_exec_impl(PyModuleDef *module, PyObject *source, PyObject *globals, PyObject *locals)
-/*[clinic end generated code: output=0281b48bfa8e3c87 input=536e057b5e00d89e]*/
+/*[clinic end generated code: output=e8e0bbcde826a048 input=536e057b5e00d89e]*/
{
PyObject *v;
@@ -1275,30 +1002,9 @@ NOTE: Updates to this dictionary *will* affect name lookups in the current
global scope and vice-versa.
[clinic start generated code]*/
-PyDoc_STRVAR(builtin_globals__doc__,
-"globals($module, /)\n"
-"--\n"
-"\n"
-"Return the dictionary containing the current scope\'s global variables.\n"
-"\n"
-"NOTE: Updates to this dictionary *will* affect name lookups in the current\n"
-"global scope and vice-versa.");
-
-#define BUILTIN_GLOBALS_METHODDEF \
- {"globals", (PyCFunction)builtin_globals, METH_NOARGS, builtin_globals__doc__},
-
-static PyObject *
-builtin_globals_impl(PyModuleDef *module);
-
-static PyObject *
-builtin_globals(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
-{
- return builtin_globals_impl(module);
-}
-
static PyObject *
builtin_globals_impl(PyModuleDef *module)
-/*[clinic end generated code: output=048640f58b1f20ad input=9327576f92bb48ba]*/
+/*[clinic end generated code: output=4958645e96dd8138 input=9327576f92bb48ba]*/
{
PyObject *d;
@@ -1320,40 +1026,9 @@ Return whether the object has an attribute with the given name.
This is done by calling getattr(obj, name) and catching AttributeError.
[clinic start generated code]*/
-PyDoc_STRVAR(builtin_hasattr__doc__,
-"hasattr($module, obj, name, /)\n"
-"--\n"
-"\n"
-"Return whether the object has an attribute with the given name.\n"
-"\n"
-"This is done by calling getattr(obj, name) and catching AttributeError.");
-
-#define BUILTIN_HASATTR_METHODDEF \
- {"hasattr", (PyCFunction)builtin_hasattr, METH_VARARGS, builtin_hasattr__doc__},
-
-static PyObject *
-builtin_hasattr_impl(PyModuleDef *module, PyObject *obj, PyObject *name);
-
-static PyObject *
-builtin_hasattr(PyModuleDef *module, PyObject *args)
-{
- PyObject *return_value = NULL;
- PyObject *obj;
- PyObject *name;
-
- if (!PyArg_UnpackTuple(args, "hasattr",
- 2, 2,
- &obj, &name))
- goto exit;
- return_value = builtin_hasattr_impl(module, obj, name);
-
-exit:
- return return_value;
-}
-
static PyObject *
builtin_hasattr_impl(PyModuleDef *module, PyObject *obj, PyObject *name)
-/*[clinic end generated code: output=e0bd996ef73d1217 input=b50bad5f739ea10d]*/
+/*[clinic end generated code: output=81154fdd63634696 input=b50bad5f739ea10d]*/
{
PyObject *v;
@@ -1392,21 +1067,9 @@ This is guaranteed to be unique among simultaneously existing objects.
(CPython uses the object's memory address.)
[clinic start generated code]*/
-PyDoc_STRVAR(builtin_id__doc__,
-"id($module, obj, /)\n"
-"--\n"
-"\n"
-"Return the identity of an object.\n"
-"\n"
-"This is guaranteed to be unique among simultaneously existing objects.\n"
-"(CPython uses the object\'s memory address.)");
-
-#define BUILTIN_ID_METHODDEF \
- {"id", (PyCFunction)builtin_id, METH_O, builtin_id__doc__},
-
static PyObject *
builtin_id(PyModuleDef *self, PyObject *v)
-/*[clinic end generated code: output=f54da09c91992e63 input=a1f988d98357341d]*/
+/*[clinic end generated code: output=0aa640785f697f65 input=a1f988d98357341d]*/
{
return PyLong_FromVoidPtr(v);
}
@@ -1639,41 +1302,9 @@ Sets the named attribute on the given object to the specified value.
setattr(x, 'y', v) is equivalent to ``x.y = v''
[clinic start generated code]*/
-PyDoc_STRVAR(builtin_setattr__doc__,
-"setattr($module, obj, name, value, /)\n"
-"--\n"
-"\n"
-"Sets the named attribute on the given object to the specified value.\n"
-"\n"
-"setattr(x, \'y\', v) is equivalent to ``x.y = v\'\'");
-
-#define BUILTIN_SETATTR_METHODDEF \
- {"setattr", (PyCFunction)builtin_setattr, METH_VARARGS, builtin_setattr__doc__},
-
-static PyObject *
-builtin_setattr_impl(PyModuleDef *module, PyObject *obj, PyObject *name, PyObject *value);
-
-static PyObject *
-builtin_setattr(PyModuleDef *module, PyObject *args)
-{
- PyObject *return_value = NULL;
- PyObject *obj;
- PyObject *name;
- PyObject *value;
-
- if (!PyArg_UnpackTuple(args, "setattr",
- 3, 3,
- &obj, &name, &value))
- goto exit;
- return_value = builtin_setattr_impl(module, obj, name, value);
-
-exit:
- return return_value;
-}
-
static PyObject *
builtin_setattr_impl(PyModuleDef *module, PyObject *obj, PyObject *name, PyObject *value)
-/*[clinic end generated code: output=4336dcbbf7691d2d input=fbe7e53403116b93]*/
+/*[clinic end generated code: output=c5e0a3a3971333ed input=fbe7e53403116b93]*/
{
if (PyObject_SetAttr(obj, name, value) != 0)
return NULL;
@@ -1694,40 +1325,9 @@ Deletes the named attribute from the given object.
delattr(x, 'y') is equivalent to ``del x.y''
[clinic start generated code]*/
-PyDoc_STRVAR(builtin_delattr__doc__,
-"delattr($module, obj, name, /)\n"
-"--\n"
-"\n"
-"Deletes the named attribute from the given object.\n"
-"\n"
-"delattr(x, \'y\') is equivalent to ``del x.y\'\'");
-
-#define BUILTIN_DELATTR_METHODDEF \
- {"delattr", (PyCFunction)builtin_delattr, METH_VARARGS, builtin_delattr__doc__},
-
-static PyObject *
-builtin_delattr_impl(PyModuleDef *module, PyObject *obj, PyObject *name);
-
-static PyObject *
-builtin_delattr(PyModuleDef *module, PyObject *args)
-{
- PyObject *return_value = NULL;
- PyObject *obj;
- PyObject *name;
-
- if (!PyArg_UnpackTuple(args, "delattr",
- 2, 2,
- &obj, &name))
- goto exit;
- return_value = builtin_delattr_impl(module, obj, name);
-
-exit:
- return return_value;
-}
-
static PyObject *
builtin_delattr_impl(PyModuleDef *module, PyObject *obj, PyObject *name)
-/*[clinic end generated code: output=319c2d884aa769cf input=647af2ce9183a823]*/
+/*[clinic end generated code: output=ef653e698a0b4187 input=647af2ce9183a823]*/
{
if (PyObject_SetAttr(obj, name, (PyObject *)NULL) != 0)
return NULL;
@@ -1748,21 +1348,9 @@ Two objects that compare equal must also have the same hash value, but the
reverse is not necessarily true.
[clinic start generated code]*/
-PyDoc_STRVAR(builtin_hash__doc__,
-"hash($module, obj, /)\n"
-"--\n"
-"\n"
-"Return the hash value for the given object.\n"
-"\n"
-"Two objects that compare equal must also have the same hash value, but the\n"
-"reverse is not necessarily true.");
-
-#define BUILTIN_HASH_METHODDEF \
- {"hash", (PyCFunction)builtin_hash, METH_O, builtin_hash__doc__},
-
static PyObject *
builtin_hash(PyModuleDef *module, PyObject *obj)
-/*[clinic end generated code: output=1ec467611c13468b input=ccc4d2b9a351df4e]*/
+/*[clinic end generated code: output=1f32ff154c1f751a input=ccc4d2b9a351df4e]*/
{
Py_hash_t x;
@@ -1785,21 +1373,9 @@ Return the hexadecimal representation of an integer.
'0xc0ffee'
[clinic start generated code]*/
-PyDoc_STRVAR(builtin_hex__doc__,
-"hex($module, number, /)\n"
-"--\n"
-"\n"
-"Return the hexadecimal representation of an integer.\n"
-"\n"
-" >>> hex(12648430)\n"
-" \'0xc0ffee\'");
-
-#define BUILTIN_HEX_METHODDEF \
- {"hex", (PyCFunction)builtin_hex, METH_O, builtin_hex__doc__},
-
static PyObject *
builtin_hex(PyModuleDef *module, PyObject *number)
-/*[clinic end generated code: output=f18e9439aeaa2c6c input=e816200b0a728ebe]*/
+/*[clinic end generated code: output=618489ce3cbc5858 input=e816200b0a728ebe]*/
{
return PyNumber_ToBase(number, 16);
}
@@ -1841,18 +1417,9 @@ len as builtin_len
Return the number of items in a container.
[clinic start generated code]*/
-PyDoc_STRVAR(builtin_len__doc__,
-"len($module, obj, /)\n"
-"--\n"
-"\n"
-"Return the number of items in a container.");
-
-#define BUILTIN_LEN_METHODDEF \
- {"len", (PyCFunction)builtin_len, METH_O, builtin_len__doc__},
-
static PyObject *
builtin_len(PyModuleDef *module, PyObject *obj)
-/*[clinic end generated code: output=5a38b0db40761705 input=2e5ff15db9a2de22]*/
+/*[clinic end generated code: output=8e5837b6f81d915b input=2e5ff15db9a2de22]*/
{
Py_ssize_t res;
@@ -1873,31 +1440,9 @@ the local scope and vice-versa is *implementation dependent* and not
covered by any backwards compatibility guarantees.
[clinic start generated code]*/
-PyDoc_STRVAR(builtin_locals__doc__,
-"locals($module, /)\n"
-"--\n"
-"\n"
-"Return a dictionary containing the current scope\'s local variables.\n"
-"\n"
-"NOTE: Whether or not updates to this dictionary will affect name lookups in\n"
-"the local scope and vice-versa is *implementation dependent* and not\n"
-"covered by any backwards compatibility guarantees.");
-
-#define BUILTIN_LOCALS_METHODDEF \
- {"locals", (PyCFunction)builtin_locals, METH_NOARGS, builtin_locals__doc__},
-
-static PyObject *
-builtin_locals_impl(PyModuleDef *module);
-
-static PyObject *
-builtin_locals(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
-{
- return builtin_locals_impl(module);
-}
-
static PyObject *
builtin_locals_impl(PyModuleDef *module)
-/*[clinic end generated code: output=8ac52522924346e2 input=7874018d478d5c4b]*/
+/*[clinic end generated code: output=8b5a41f12e19d13a input=7874018d478d5c4b]*/
{
PyObject *d;
@@ -2054,21 +1599,9 @@ Return the octal representation of an integer.
'0o1234567'
[clinic start generated code]*/
-PyDoc_STRVAR(builtin_oct__doc__,
-"oct($module, number, /)\n"
-"--\n"
-"\n"
-"Return the octal representation of an integer.\n"
-"\n"
-" >>> oct(342391)\n"
-" \'0o1234567\'");
-
-#define BUILTIN_OCT_METHODDEF \
- {"oct", (PyCFunction)builtin_oct, METH_O, builtin_oct__doc__},
-
static PyObject *
builtin_oct(PyModuleDef *module, PyObject *number)
-/*[clinic end generated code: output=b99234d1d70a6673 input=a3a372b521b3dd13]*/
+/*[clinic end generated code: output=18f701bc6d8f804a input=a3a372b521b3dd13]*/
{
return PyNumber_ToBase(number, 8);
}
@@ -2083,18 +1616,9 @@ ord as builtin_ord
Return the Unicode code point for a one-character string.
[clinic start generated code]*/
-PyDoc_STRVAR(builtin_ord__doc__,
-"ord($module, c, /)\n"
-"--\n"
-"\n"
-"Return the Unicode code point for a one-character string.");
-
-#define BUILTIN_ORD_METHODDEF \
- {"ord", (PyCFunction)builtin_ord, METH_O, builtin_ord__doc__},
-
static PyObject *
builtin_ord(PyModuleDef *module, PyObject *c)
-/*[clinic end generated code: output=a8466d23bd76db3f input=762355f87451efa3]*/
+/*[clinic end generated code: output=04fd27272d9462f6 input=762355f87451efa3]*/
{
long ord;
Py_ssize_t size;
@@ -2152,42 +1676,9 @@ Some types, such as ints, are able to use a more efficient algorithm when
invoked using the three argument form.
[clinic start generated code]*/
-PyDoc_STRVAR(builtin_pow__doc__,
-"pow($module, x, y, z=None, /)\n"
-"--\n"
-"\n"
-"Equivalent to x**y (with two arguments) or x**y % z (with three arguments)\n"
-"\n"
-"Some types, such as ints, are able to use a more efficient algorithm when\n"
-"invoked using the three argument form.");
-
-#define BUILTIN_POW_METHODDEF \
- {"pow", (PyCFunction)builtin_pow, METH_VARARGS, builtin_pow__doc__},
-
-static PyObject *
-builtin_pow_impl(PyModuleDef *module, PyObject *x, PyObject *y, PyObject *z);
-
-static PyObject *
-builtin_pow(PyModuleDef *module, PyObject *args)
-{
- PyObject *return_value = NULL;
- PyObject *x;
- PyObject *y;
- PyObject *z = Py_None;
-
- if (!PyArg_UnpackTuple(args, "pow",
- 2, 3,
- &x, &y, &z))
- goto exit;
- return_value = builtin_pow_impl(module, x, y, z);
-
-exit:
- return return_value;
-}
-
static PyObject *
builtin_pow_impl(PyModuleDef *module, PyObject *x, PyObject *y, PyObject *z)
-/*[clinic end generated code: output=d0cdf314311dedba input=561a942d5f5c1899]*/
+/*[clinic end generated code: output=1fba268adba9b45f input=561a942d5f5c1899]*/
{
return PyNumber_Power(x, y, z);
}
@@ -2304,43 +1795,9 @@ If the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError.
On *nix systems, readline is used if available.
[clinic start generated code]*/
-PyDoc_STRVAR(builtin_input__doc__,
-"input($module, prompt=None, /)\n"
-"--\n"
-"\n"
-"Read a string from standard input. The trailing newline is stripped.\n"
-"\n"
-"The prompt string, if given, is printed to standard output without a\n"
-"trailing newline before reading input.\n"
-"\n"
-"If the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError.\n"
-"On *nix systems, readline is used if available.");
-
-#define BUILTIN_INPUT_METHODDEF \
- {"input", (PyCFunction)builtin_input, METH_VARARGS, builtin_input__doc__},
-
-static PyObject *
-builtin_input_impl(PyModuleDef *module, PyObject *prompt);
-
-static PyObject *
-builtin_input(PyModuleDef *module, PyObject *args)
-{
- PyObject *return_value = NULL;
- PyObject *prompt = NULL;
-
- if (!PyArg_UnpackTuple(args, "input",
- 0, 1,
- &prompt))
- goto exit;
- return_value = builtin_input_impl(module, prompt);
-
-exit:
- return return_value;
-}
-
static PyObject *
builtin_input_impl(PyModuleDef *module, PyObject *prompt)
-/*[clinic end generated code: output=69323bf5695f7c9c input=5e8bb70c2908fe3c]*/
+/*[clinic end generated code: output=b77731f59e1515c4 input=5e8bb70c2908fe3c]*/
{
PyObject *fin = _PySys_GetObjectId(&PyId_stdin);
PyObject *fout = _PySys_GetObjectId(&PyId_stdout);
@@ -2523,20 +1980,9 @@ Return the canonical string representation of the object.
For many object types, including most builtins, eval(repr(obj)) == obj.
[clinic start generated code]*/
-PyDoc_STRVAR(builtin_repr__doc__,
-"repr($module, obj, /)\n"
-"--\n"
-"\n"
-"Return the canonical string representation of the object.\n"
-"\n"
-"For many object types, including most builtins, eval(repr(obj)) == obj.");
-
-#define BUILTIN_REPR_METHODDEF \
- {"repr", (PyCFunction)builtin_repr, METH_O, builtin_repr__doc__},
-
static PyObject *
builtin_repr(PyModuleDef *module, PyObject *obj)
-/*[clinic end generated code: output=988980120f39e2fa input=a2bca0f38a5a924d]*/
+/*[clinic end generated code: output=dc41784fa4341834 input=a2bca0f38a5a924d]*/
{
return PyObject_Repr(obj);
}
@@ -2704,42 +2150,9 @@ This function is intended specifically for use with numeric values and may
reject non-numeric types.
[clinic start generated code]*/
-PyDoc_STRVAR(builtin_sum__doc__,
-"sum($module, iterable, start=0, /)\n"
-"--\n"
-"\n"
-"Return the sum of a \'start\' value (default: 0) plus an iterable of numbers\n"
-"\n"
-"When the iterable is empty, return the start value.\n"
-"This function is intended specifically for use with numeric values and may\n"
-"reject non-numeric types.");
-
-#define BUILTIN_SUM_METHODDEF \
- {"sum", (PyCFunction)builtin_sum, METH_VARARGS, builtin_sum__doc__},
-
-static PyObject *
-builtin_sum_impl(PyModuleDef *module, PyObject *iterable, PyObject *start);
-
-static PyObject *
-builtin_sum(PyModuleDef *module, PyObject *args)
-{
- PyObject *return_value = NULL;
- PyObject *iterable;
- PyObject *start = NULL;
-
- if (!PyArg_UnpackTuple(args, "sum",
- 1, 2,
- &iterable, &start))
- goto exit;
- return_value = builtin_sum_impl(module, iterable, start);
-
-exit:
- return return_value;
-}
-
static PyObject *
builtin_sum_impl(PyModuleDef *module, PyObject *iterable, PyObject *start)
-/*[clinic end generated code: output=b42652a0d5f64f6b input=90ae7a242cfcf025]*/
+/*[clinic end generated code: output=33655b248b21d581 input=90ae7a242cfcf025]*/
{
PyObject *result = start;
PyObject *temp, *item, *iter;
@@ -2914,42 +2327,9 @@ check against. This is equivalent to ``isinstance(x, A) or isinstance(x, B)
or ...`` etc.
[clinic start generated code]*/
-PyDoc_STRVAR(builtin_isinstance__doc__,
-"isinstance($module, obj, class_or_tuple, /)\n"
-"--\n"
-"\n"
-"Return whether an object is an instance of a class or of a subclass thereof.\n"
-"\n"
-"A tuple, as in ``isinstance(x, (A, B, ...))``, may be given as the target to\n"
-"check against. This is equivalent to ``isinstance(x, A) or isinstance(x, B)\n"
-"or ...`` etc.");
-
-#define BUILTIN_ISINSTANCE_METHODDEF \
- {"isinstance", (PyCFunction)builtin_isinstance, METH_VARARGS, builtin_isinstance__doc__},
-
-static PyObject *
-builtin_isinstance_impl(PyModuleDef *module, PyObject *obj, PyObject *class_or_tuple);
-
-static PyObject *
-builtin_isinstance(PyModuleDef *module, PyObject *args)
-{
- PyObject *return_value = NULL;
- PyObject *obj;
- PyObject *class_or_tuple;
-
- if (!PyArg_UnpackTuple(args, "isinstance",
- 2, 2,
- &obj, &class_or_tuple))
- goto exit;
- return_value = builtin_isinstance_impl(module, obj, class_or_tuple);
-
-exit:
- return return_value;
-}
-
static PyObject *
builtin_isinstance_impl(PyModuleDef *module, PyObject *obj, PyObject *class_or_tuple)
-/*[clinic end generated code: output=847df57fef8ddea7 input=cf9eb0ad6bb9bad6]*/
+/*[clinic end generated code: output=5e234dc3872d75a2 input=cf9eb0ad6bb9bad6]*/
{
int retval;
@@ -2974,42 +2354,9 @@ check against. This is equivalent to ``issubclass(x, A) or issubclass(x, B)
or ...`` etc.
[clinic start generated code]*/
-PyDoc_STRVAR(builtin_issubclass__doc__,
-"issubclass($module, cls, class_or_tuple, /)\n"
-"--\n"
-"\n"
-"Return whether \'cls\' is a derived from another class or is the same class.\n"
-"\n"
-"A tuple, as in ``issubclass(x, (A, B, ...))``, may be given as the target to\n"
-"check against. This is equivalent to ``issubclass(x, A) or issubclass(x, B)\n"
-"or ...`` etc.");
-
-#define BUILTIN_ISSUBCLASS_METHODDEF \
- {"issubclass", (PyCFunction)builtin_issubclass, METH_VARARGS, builtin_issubclass__doc__},
-
-static PyObject *
-builtin_issubclass_impl(PyModuleDef *module, PyObject *cls, PyObject *class_or_tuple);
-
-static PyObject *
-builtin_issubclass(PyModuleDef *module, PyObject *args)
-{
- PyObject *return_value = NULL;
- PyObject *cls;
- PyObject *class_or_tuple;
-
- if (!PyArg_UnpackTuple(args, "issubclass",
- 2, 2,
- &cls, &class_or_tuple))
- goto exit;
- return_value = builtin_issubclass_impl(module, cls, class_or_tuple);
-
-exit:
- return return_value;
-}
-
static PyObject *
builtin_issubclass_impl(PyModuleDef *module, PyObject *cls, PyObject *class_or_tuple)
-/*[clinic end generated code: output=a0f8c03692e35474 input=923d03fa41fc352a]*/
+/*[clinic end generated code: output=6346a85ba15dbd7d input=923d03fa41fc352a]*/
{
int retval;