summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/Python/bltinmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/tools/python3/Python/bltinmodule.c')
-rw-r--r--contrib/tools/python3/Python/bltinmodule.c121
1 files changed, 65 insertions, 56 deletions
diff --git a/contrib/tools/python3/Python/bltinmodule.c b/contrib/tools/python3/Python/bltinmodule.c
index bcf7e7355da..e107c997e71 100644
--- a/contrib/tools/python3/Python/bltinmodule.c
+++ b/contrib/tools/python3/Python/bltinmodule.c
@@ -264,15 +264,16 @@ should be a list of names to emulate ``from name import ...``, or an
empty list to emulate ``import name``.
When importing a module from a package, note that __import__('A.B', ...)
returns package A when fromlist is empty, but its submodule B when
-fromlist is not empty. The level argument is used to determine whether to
-perform absolute or relative imports: 0 is absolute, while a positive number
-is the number of parent directories to search relative to the current module.
+fromlist is not empty. The level argument is used to determine whether
+to perform absolute or relative imports: 0 is absolute, while a positive
+number is the number of parent directories to search relative to the
+current module.
[clinic start generated code]*/
static PyObject *
builtin___import___impl(PyObject *module, PyObject *name, PyObject *globals,
PyObject *locals, PyObject *fromlist, int level)
-/*[clinic end generated code: output=4febeda88a0cd245 input=73f4b960ea5b9dd6]*/
+/*[clinic end generated code: output=4febeda88a0cd245 input=e3096a230383f72d]*/
{
return PyImport_ImportModuleLevelObject(name, globals, locals,
fromlist, level);
@@ -622,8 +623,9 @@ PyDoc_STRVAR(filter_doc,
"filter(function, iterable, /)\n\
--\n\
\n\
-Return an iterator yielding those items of iterable for which function(item)\n\
-is true. If function is None, return the items that are true.");
+Return an iterator yielding those items of iterable for which\n\
+function(item) is true. If function is None, return the items that\n\
+are true.");
PyTypeObject PyFilter_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
@@ -743,23 +745,24 @@ compile as builtin_compile
Compile source into a code object that can be executed by exec() or eval().
-The source code may represent a Python module, statement or expression.
+The source code may represent a Python module, statement or
+expression.
The filename will be used for run-time error messages.
The mode must be 'exec' to compile a module, 'single' to compile a
single (interactive) statement, or 'eval' to compile an expression.
-The flags argument, if present, controls which future statements influence
-the compilation of the code.
+The flags argument, if present, controls which future statements
+influence the compilation of the code.
The dont_inherit argument, if true, stops the compilation inheriting
the effects of any future statements in effect in the code calling
-compile; if absent or false these statements do influence the compilation,
-in addition to any features explicitly specified.
+compile; if absent or false these statements do influence the
+compilation, in addition to any features explicitly specified.
[clinic start generated code]*/
static PyObject *
builtin_compile_impl(PyObject *module, PyObject *source, PyObject *filename,
const char *mode, int flags, int dont_inherit,
int optimize, int feature_version)
-/*[clinic end generated code: output=b0c09c84f116d3d7 input=8f0069edbdac381b]*/
+/*[clinic end generated code: output=b0c09c84f116d3d7 input=d69ec2180ff24031]*/
{
PyObject *source_copy;
const char *str;
@@ -903,10 +906,10 @@ PyDoc_STRVAR(dir_doc,
"dir([object]) -> list of strings\n"
"\n"
"If called without an argument, return the names in the current scope.\n"
-"Else, return an alphabetized list of names comprising (some of) the attributes\n"
-"of the given object, and of attributes reachable from it.\n"
-"If the object supplies a method named __dir__, it will be used; otherwise\n"
-"the default dir() logic is used and returns:\n"
+"Else, return an alphabetized list of names comprising (some of) the\n"
+"attributes of the given object, and of attributes reachable from it.\n"
+"If the object supplies a method named __dir__, it will be used;\n"
+"otherwise the default dir() logic is used and returns:\n"
" for a module object: the module's attributes.\n"
" for a class object: its attributes, and recursively the attributes\n"
" of its bases.\n"
@@ -1209,9 +1212,11 @@ builtin_getattr(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
PyDoc_STRVAR(getattr_doc,
"getattr(object, name[, default]) -> value\n\
\n\
-Get a named attribute from an object; getattr(x, 'y') is equivalent to x.y.\n\
-When a default argument is given, it is returned when the attribute doesn't\n\
-exist; without it, an exception is raised in that case.");
+Get a named attribute from an object.\n\
+\n\
+getattr(x, 'y') is equivalent to x.y.\n\
+When a default argument is given, it is returned when the attribute\n\
+doesn't exist; without it, an exception is raised in that case.");
/*[clinic input]
@@ -1219,13 +1224,13 @@ globals as builtin_globals
Return the dictionary containing the current scope's global variables.
-NOTE: Updates to this dictionary *will* affect name lookups in the current
-global scope and vice-versa.
+NOTE: Updates to this dictionary *will* affect name lookups in the
+current global scope and vice-versa.
[clinic start generated code]*/
static PyObject *
builtin_globals_impl(PyObject *module)
-/*[clinic end generated code: output=e5dd1527067b94d2 input=9327576f92bb48ba]*/
+/*[clinic end generated code: output=e5dd1527067b94d2 input=6d725a9b48d1eaeb]*/
{
PyObject *d;
@@ -1564,8 +1569,8 @@ builtin_next(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
PyDoc_STRVAR(next_doc,
"next(iterator[, default])\n\
\n\
-Return the next item from the iterator. If default is given and the iterator\n\
-is exhausted, it is returned instead of raising StopIteration.");
+Return the next item from the iterator. If default is given and the\n\
+iterator is exhausted, it is returned instead of raising StopIteration.");
/*[clinic input]
@@ -1686,7 +1691,8 @@ iter(callable, sentinel) -> iterator\n\
\n\
Get an iterator from an object. In the first form, the argument must\n\
supply its own iterator, or be a sequence.\n\
-In the second form, the callable is called until it returns the sentinel.");
+In the second form, the callable is called until it returns the\n\
+sentinel.");
/*[clinic input]
@@ -1780,14 +1786,15 @@ locals as builtin_locals
Return a dictionary containing the current scope's local variables.
-NOTE: Whether or not updates to this dictionary will affect name lookups in
-the local scope and vice-versa is *implementation dependent* and not
-covered by any backwards compatibility guarantees.
+NOTE: Whether or not updates to this dictionary will affect name
+lookups in the local scope and vice-versa is *implementation
+dependent* and not covered by any backwards compatibility
+guarantees.
[clinic start generated code]*/
static PyObject *
builtin_locals_impl(PyObject *module)
-/*[clinic end generated code: output=b46c94015ce11448 input=7874018d478d5c4b]*/
+/*[clinic end generated code: output=b46c94015ce11448 input=989cc75c22167c42]*/
{
return _PyEval_GetFrameLocals();
}
@@ -2033,14 +2040,14 @@ pow as builtin_pow
Equivalent to base**exp with 2 arguments or base**exp % mod with 3 arguments
-Some types, such as ints, are able to use a more efficient algorithm when
-invoked using the three argument form.
+Some types, such as ints, are able to use a more efficient algorithm
+when invoked using the three argument form.
[clinic start generated code]*/
static PyObject *
builtin_pow_impl(PyObject *module, PyObject *base, PyObject *exp,
PyObject *mod)
-/*[clinic end generated code: output=3ca1538221bbf15f input=435dbd48a12efb23]*/
+/*[clinic end generated code: output=3ca1538221bbf15f input=6133ded72c7db82e]*/
{
return PyNumber_Power(base, exp, mod);
}
@@ -2160,13 +2167,14 @@ Read a string from standard input. The trailing newline is stripped.
The prompt string, if given, is printed to standard output without a
trailing newline before reading input.
-If the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError.
+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]*/
static PyObject *
builtin_input_impl(PyObject *module, PyObject *prompt)
-/*[clinic end generated code: output=83db5a191e7a0d60 input=159c46d4ae40977e]*/
+/*[clinic end generated code: output=83db5a191e7a0d60 input=ebb939c954639427]*/
{
PyObject *fin = NULL;
PyObject *fout = NULL;
@@ -2434,13 +2442,14 @@ round as builtin_round
Round a number to a given precision in decimal digits.
-The return value is an integer if ndigits is omitted or None. Otherwise
-the return value has the same type as the number. ndigits may be negative.
+The return value is an integer if ndigits is omitted or None.
+Otherwise the return value has the same type as the number. ndigits
+may be negative.
[clinic start generated code]*/
static PyObject *
builtin_round_impl(PyObject *module, PyObject *number, PyObject *ndigits)
-/*[clinic end generated code: output=ff0d9dd176c02ede input=275678471d7aca15]*/
+/*[clinic end generated code: output=ff0d9dd176c02ede input=bdcb7c67bf4a4320]*/
{
PyObject *round, *result;
@@ -2475,8 +2484,8 @@ sorted as builtin_sorted
Return a new list containing all items from the iterable in ascending order.
-A custom key function can be supplied to customize the sort order, and the
-reverse flag can be set to request the result in descending order.
+A custom key function can be supplied to customize the sort order, and
+the reverse flag can be set to request the result in descending order.
[end disabled clinic input]*/
PyDoc_STRVAR(builtin_sorted__doc__,
@@ -2561,13 +2570,13 @@ sum as builtin_sum
Return the sum of a 'start' value (default: 0) plus an iterable of numbers
When the iterable is empty, return the start value.
-This function is intended specifically for use with numeric values and may
-reject non-numeric types.
+This function is intended specifically for use with numeric values and
+may reject non-numeric types.
[clinic start generated code]*/
static PyObject *
builtin_sum_impl(PyObject *module, PyObject *iterable, PyObject *start)
-/*[clinic end generated code: output=df758cec7d1d302f input=162b50765250d222]*/
+/*[clinic end generated code: output=df758cec7d1d302f input=83d1bc7fd7f7ad3b]*/
{
PyObject *result = start;
PyObject *temp, *item, *iter;
@@ -2771,15 +2780,15 @@ isinstance as builtin_isinstance
Return whether an object is an instance of a class or of a subclass thereof.
-A tuple, as in ``isinstance(x, (A, B, ...))``, may be given as the target to
-check against. This is equivalent to ``isinstance(x, A) or isinstance(x, B)
-or ...`` etc.
+A tuple, as in ``isinstance(x, (A, B, ...))``, may be given as the
+target to check against. This is equivalent to ``isinstance(x, A) or
+isinstance(x, B) or ...`` etc.
[clinic start generated code]*/
static PyObject *
builtin_isinstance_impl(PyObject *module, PyObject *obj,
PyObject *class_or_tuple)
-/*[clinic end generated code: output=6faf01472c13b003 input=ffa743db1daf7549]*/
+/*[clinic end generated code: output=6faf01472c13b003 input=477d04768621c24b]*/
{
int retval;
@@ -2799,15 +2808,15 @@ issubclass as builtin_issubclass
Return whether 'cls' is derived from another class or is the same class.
-A tuple, as in ``issubclass(x, (A, B, ...))``, may be given as the target to
-check against. This is equivalent to ``issubclass(x, A) or issubclass(x, B)
-or ...``.
+A tuple, as in ``issubclass(x, (A, B, ...))``, may be given as the
+target to check against. This is equivalent to ``issubclass(x, A) or
+issubclass(x, B) or ...``.
[clinic start generated code]*/
static PyObject *
builtin_issubclass_impl(PyObject *module, PyObject *cls,
PyObject *class_or_tuple)
-/*[clinic end generated code: output=358412410cd7a250 input=a24b9f3d58c370d6]*/
+/*[clinic end generated code: output=358412410cd7a250 input=a91ce96345a6705d]*/
{
int retval;
@@ -3032,13 +3041,13 @@ PyDoc_STRVAR(zip_doc,
"zip(*iterables, strict=False)\n\
--\n\
\n\
-The zip object yields n-length tuples, where n is the number of iterables\n\
-passed as positional arguments to zip(). The i-th element in every tuple\n\
-comes from the i-th iterable argument to zip(). This continues until the\n\
-shortest argument is exhausted.\n\
+The zip object yields n-length tuples, where n is the number of\n\
+iterables passed as positional arguments to zip(). The i-th element\n\
+in every tuple comes from the i-th iterable argument to zip(). This\n\
+continues until the shortest argument is exhausted.\n\
\n\
-If strict is true and one of the arguments is exhausted before the others,\n\
-raise a ValueError.\n\
+If strict is true and one of the arguments is exhausted before the\n\
+others, raise a ValueError.\n\
\n\
>>> list(zip('abcdefg', range(3), range(4)))\n\
[('a', 0, 0), ('b', 1, 1), ('c', 2, 2)]");