mirror of
https://github.com/python/cpython.git
synced 2026-06-04 16:50:51 +00:00
gh-150285: Fix too long docstrings in builtins (GH-150293)
* gh-150285: Fix too long docstrings in builtins * Revert bytes and bytearray class multiline docstrings to make IDLE happy.
This commit is contained in:
parent
9fceb1c0c5
commit
e1e06be119
26 changed files with 613 additions and 553 deletions
|
|
@ -1620,6 +1620,7 @@ bytearray_take_bytes_impl(PyByteArrayObject *self, PyObject *n)
|
|||
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_summary
|
||||
@critical_section
|
||||
bytearray.translate
|
||||
|
||||
|
|
@ -1630,14 +1631,15 @@ bytearray.translate
|
|||
|
||||
Return a copy with each character mapped by the given translation table.
|
||||
|
||||
All characters occurring in the optional argument delete are removed.
|
||||
The remaining characters are mapped through the given translation table.
|
||||
All characters occurring in the optional argument delete are
|
||||
removed. The remaining characters are mapped through the given
|
||||
translation table.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bytearray_translate_impl(PyByteArrayObject *self, PyObject *table,
|
||||
PyObject *deletechars)
|
||||
/*[clinic end generated code: output=b6a8f01c2a74e446 input=cd6fa93ca04e05bc]*/
|
||||
/*[clinic end generated code: output=b6a8f01c2a74e446 input=e30d2ae004365ed9]*/
|
||||
{
|
||||
char *input, *output;
|
||||
const char *table_chars;
|
||||
|
|
@ -1727,7 +1729,6 @@ bytearray_translate_impl(PyByteArrayObject *self, PyObject *table,
|
|||
/*[clinic input]
|
||||
|
||||
@permit_long_summary
|
||||
@permit_long_docstring_body
|
||||
@staticmethod
|
||||
bytearray.maketrans
|
||||
|
||||
|
|
@ -1737,15 +1738,15 @@ bytearray.maketrans
|
|||
|
||||
Return a translation table usable for the bytes or bytearray translate method.
|
||||
|
||||
The returned table will be one where each byte in frm is mapped to the byte at
|
||||
the same position in to.
|
||||
The returned table will be one where each byte in frm is mapped to
|
||||
the byte at the same position in to.
|
||||
|
||||
The bytes objects frm and to must be of the same length.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bytearray_maketrans_impl(Py_buffer *frm, Py_buffer *to)
|
||||
/*[clinic end generated code: output=1df267d99f56b15e input=1146b43a592eca13]*/
|
||||
/*[clinic end generated code: output=1df267d99f56b15e input=c2f5f6e7e6b0221d]*/
|
||||
{
|
||||
return _Py_bytes_maketrans(frm, to);
|
||||
}
|
||||
|
|
@ -1785,8 +1786,8 @@ bytearray.split
|
|||
|
||||
sep: object = None
|
||||
The delimiter according which to split the bytearray.
|
||||
None (the default value) means split on ASCII whitespace characters
|
||||
(space, tab, return, newline, formfeed, vertical tab).
|
||||
None (the default value) means split on ASCII whitespace
|
||||
characters (space, tab, return, newline, formfeed, vertical tab).
|
||||
maxsplit: Py_ssize_t = -1
|
||||
Maximum number of splits to do.
|
||||
-1 (the default value) means no limit.
|
||||
|
|
@ -1797,7 +1798,7 @@ Return a list of the sections in the bytearray, using sep as the delimiter.
|
|||
static PyObject *
|
||||
bytearray_split_impl(PyByteArrayObject *self, PyObject *sep,
|
||||
Py_ssize_t maxsplit)
|
||||
/*[clinic end generated code: output=833e2cf385d9a04d input=dd9f6e2910cc3a34]*/
|
||||
/*[clinic end generated code: output=833e2cf385d9a04d input=45605178023b52ac]*/
|
||||
{
|
||||
PyObject *list = NULL;
|
||||
|
||||
|
|
@ -1829,7 +1830,6 @@ bytearray_split_impl(PyByteArrayObject *self, PyObject *sep,
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_docstring_body
|
||||
@critical_section
|
||||
bytearray.partition
|
||||
|
||||
|
|
@ -1838,17 +1838,18 @@ bytearray.partition
|
|||
|
||||
Partition the bytearray into three parts using the given separator.
|
||||
|
||||
This will search for the separator sep in the bytearray. If the separator is
|
||||
found, returns a 3-tuple containing the part before the separator, the
|
||||
separator itself, and the part after it as new bytearray objects.
|
||||
This will search for the separator sep in the bytearray. If the
|
||||
separator is found, returns a 3-tuple containing the part before the
|
||||
separator, the separator itself, and the part after it as new
|
||||
bytearray objects.
|
||||
|
||||
If the separator is not found, returns a 3-tuple containing the copy of the
|
||||
original bytearray object and two empty bytearray objects.
|
||||
If the separator is not found, returns a 3-tuple containing the copy
|
||||
of the original bytearray object and two empty bytearray objects.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bytearray_partition_impl(PyByteArrayObject *self, PyObject *sep)
|
||||
/*[clinic end generated code: output=b5fa1e03f10cfccb input=b87276af883f39d9]*/
|
||||
/*[clinic end generated code: output=b5fa1e03f10cfccb input=d76673ed03acf5dd]*/
|
||||
{
|
||||
PyObject *bytesep, *result;
|
||||
|
||||
|
|
@ -1868,7 +1869,6 @@ bytearray_partition_impl(PyByteArrayObject *self, PyObject *sep)
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_docstring_body
|
||||
@critical_section
|
||||
bytearray.rpartition
|
||||
|
||||
|
|
@ -1877,18 +1877,19 @@ bytearray.rpartition
|
|||
|
||||
Partition the bytearray into three parts using the given separator.
|
||||
|
||||
This will search for the separator sep in the bytearray, starting at the end.
|
||||
If the separator is found, returns a 3-tuple containing the part before the
|
||||
separator, the separator itself, and the part after it as new bytearray
|
||||
objects.
|
||||
This will search for the separator sep in the bytearray, starting at
|
||||
the end. If the separator is found, returns a 3-tuple containing
|
||||
the part before the separator, the separator itself, and the part
|
||||
after it as new bytearray objects.
|
||||
|
||||
If the separator is not found, returns a 3-tuple containing two empty bytearray
|
||||
objects and the copy of the original bytearray object.
|
||||
If the separator is not found, returns a 3-tuple containing two
|
||||
empty bytearray objects and the copy of the original bytearray
|
||||
object.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bytearray_rpartition_impl(PyByteArrayObject *self, PyObject *sep)
|
||||
/*[clinic end generated code: output=0186ce7b1ef61289 input=5bdcfc4c333bcfab]*/
|
||||
/*[clinic end generated code: output=0186ce7b1ef61289 input=b9216a2074174a36]*/
|
||||
{
|
||||
PyObject *bytesep, *result;
|
||||
|
||||
|
|
@ -1909,19 +1910,19 @@ bytearray_rpartition_impl(PyByteArrayObject *self, PyObject *sep)
|
|||
|
||||
/*[clinic input]
|
||||
@permit_long_summary
|
||||
@permit_long_docstring_body
|
||||
@critical_section
|
||||
bytearray.rsplit = bytearray.split
|
||||
|
||||
Return a list of the sections in the bytearray, using sep as the delimiter.
|
||||
|
||||
Splitting is done starting at the end of the bytearray and working to the front.
|
||||
Splitting is done starting at the end of the bytearray and working
|
||||
to the front.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bytearray_rsplit_impl(PyByteArrayObject *self, PyObject *sep,
|
||||
Py_ssize_t maxsplit)
|
||||
/*[clinic end generated code: output=a55e0b5a03cb6190 input=60e9abf305128ff4]*/
|
||||
/*[clinic end generated code: output=a55e0b5a03cb6190 input=e201671c9a0c19ee]*/
|
||||
{
|
||||
PyObject *list = NULL;
|
||||
|
||||
|
|
@ -2392,7 +2393,6 @@ bytearray_strip_impl_helper(PyByteArrayObject* self, PyObject* bytes, int stript
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_docstring_body
|
||||
@critical_section
|
||||
bytearray.strip
|
||||
|
||||
|
|
@ -2401,12 +2401,13 @@ bytearray.strip
|
|||
|
||||
Strip leading and trailing bytes contained in the argument.
|
||||
|
||||
If the argument is omitted or None, strip leading and trailing ASCII whitespace.
|
||||
If the argument is omitted or None, strip leading and trailing ASCII
|
||||
whitespace.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bytearray_strip_impl(PyByteArrayObject *self, PyObject *bytes)
|
||||
/*[clinic end generated code: output=760412661a34ad5a input=6acaf88b2ec9daa7]*/
|
||||
/*[clinic end generated code: output=760412661a34ad5a input=f4ec5fa609df7d14]*/
|
||||
{
|
||||
return bytearray_strip_impl_helper(self, bytes, BOTHSTRIP);
|
||||
}
|
||||
|
|
@ -2506,11 +2507,11 @@ bytearray.decode
|
|||
encoding: str(c_default="NULL") = 'utf-8'
|
||||
The encoding with which to decode the bytearray.
|
||||
errors: str(c_default="NULL") = 'strict'
|
||||
The error handling scheme to use for the handling of decoding errors.
|
||||
The default is 'strict' meaning that decoding errors raise a
|
||||
UnicodeDecodeError. Other possible values are 'ignore' and 'replace'
|
||||
as well as any other name registered with codecs.register_error that
|
||||
can handle UnicodeDecodeErrors.
|
||||
The error handling scheme to use for the handling of decoding
|
||||
errors. The default is 'strict' meaning that decoding errors
|
||||
raise a UnicodeDecodeError. Other possible values are 'ignore'
|
||||
and 'replace' as well as any other name registered with
|
||||
codecs.register_error that can handle UnicodeDecodeErrors.
|
||||
|
||||
Decode the bytearray using the codec registered for encoding.
|
||||
[clinic start generated code]*/
|
||||
|
|
@ -2518,7 +2519,7 @@ Decode the bytearray using the codec registered for encoding.
|
|||
static PyObject *
|
||||
bytearray_decode_impl(PyByteArrayObject *self, const char *encoding,
|
||||
const char *errors)
|
||||
/*[clinic end generated code: output=f57d43f4a00b42c5 input=86c303ee376b8453]*/
|
||||
/*[clinic end generated code: output=f57d43f4a00b42c5 input=e51ce9b82b51e2ca]*/
|
||||
{
|
||||
if (encoding == NULL)
|
||||
encoding = PyUnicode_GetDefaultEncoding();
|
||||
|
|
@ -2550,14 +2551,15 @@ bytearray.join
|
|||
|
||||
Concatenate any number of bytes/bytearray objects.
|
||||
|
||||
The bytearray whose method is called is inserted in between each pair.
|
||||
The bytearray whose method is called is inserted in between each
|
||||
pair.
|
||||
|
||||
The result is returned as a new bytearray object.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bytearray_join_impl(PyByteArrayObject *self, PyObject *iterable_of_bytes)
|
||||
/*[clinic end generated code: output=0ced382b5846a7ee input=49627e07ca31ca26]*/
|
||||
/*[clinic end generated code: output=0ced382b5846a7ee input=0a31db349efcd7fa]*/
|
||||
{
|
||||
PyObject *ret;
|
||||
self->ob_exports++; // this protects `self` from being cleared/resized if `iterable_of_bytes` is a custom iterator
|
||||
|
|
@ -2588,7 +2590,6 @@ bytearray_rjust(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
|
|||
|
||||
/*[clinic input]
|
||||
@permit_long_summary
|
||||
@permit_long_docstring_body
|
||||
@critical_section
|
||||
bytearray.splitlines
|
||||
|
||||
|
|
@ -2596,13 +2597,13 @@ bytearray.splitlines
|
|||
|
||||
Return a list of the lines in the bytearray, breaking at line boundaries.
|
||||
|
||||
Line breaks are not included in the resulting list unless keepends is given and
|
||||
true.
|
||||
Line breaks are not included in the resulting list unless keepends
|
||||
is given and true.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bytearray_splitlines_impl(PyByteArrayObject *self, int keepends)
|
||||
/*[clinic end generated code: output=4223c94b895f6ad9 input=21bc3f02bf1be832]*/
|
||||
/*[clinic end generated code: output=4223c94b895f6ad9 input=cc2bb740eed19f27]*/
|
||||
{
|
||||
return stringlib_splitlines(
|
||||
(PyObject*) self, PyByteArray_AS_STRING(self),
|
||||
|
|
@ -2620,12 +2621,13 @@ bytearray.fromhex
|
|||
Create a bytearray object from a string of hexadecimal numbers.
|
||||
|
||||
Spaces between two numbers are accepted.
|
||||
Example: bytearray.fromhex('B9 01EF') -> bytearray(b'\\xb9\\x01\\xef')
|
||||
Example:
|
||||
bytearray.fromhex('B9 01EF') -> bytearray(b'\\xb9\\x01\\xef')
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bytearray_fromhex_impl(PyTypeObject *type, PyObject *string)
|
||||
/*[clinic end generated code: output=8f0f0b6d30fb3ba0 input=7e314e5b2d7ab484]*/
|
||||
/*[clinic end generated code: output=8f0f0b6d30fb3ba0 input=2243a8b0b9e66cd5]*/
|
||||
{
|
||||
PyObject *result = _PyBytes_FromHex(string, type == &PyByteArray_Type);
|
||||
if (type != &PyByteArray_Type && result != NULL) {
|
||||
|
|
@ -2641,8 +2643,8 @@ bytearray.hex
|
|||
sep: object = NULL
|
||||
An optional single character or byte to separate hex bytes.
|
||||
bytes_per_sep: Py_ssize_t = 1
|
||||
How many bytes between separators. Positive values count from the
|
||||
right, negative values count from the left.
|
||||
How many bytes between separators. Positive values count from
|
||||
the right, negative values count from the left.
|
||||
|
||||
Create a string of hexadecimal numbers from a bytearray object.
|
||||
|
||||
|
|
@ -2661,7 +2663,7 @@ Create a string of hexadecimal numbers from a bytearray object.
|
|||
static PyObject *
|
||||
bytearray_hex_impl(PyByteArrayObject *self, PyObject *sep,
|
||||
Py_ssize_t bytes_per_sep)
|
||||
/*[clinic end generated code: output=c9563921aff1262b input=d2b23ef057cfcad5]*/
|
||||
/*[clinic end generated code: output=c9563921aff1262b input=9ed746203691e894]*/
|
||||
{
|
||||
char* argbuf = PyByteArray_AS_STRING(self);
|
||||
Py_ssize_t arglen = PyByteArray_GET_SIZE(self);
|
||||
|
|
|
|||
|
|
@ -277,8 +277,8 @@ _Py_bytes_upper(char *result, const char *cptr, Py_ssize_t len)
|
|||
PyDoc_STRVAR_shared(_Py_title__doc__,
|
||||
"B.title() -> copy of B\n\
|
||||
\n\
|
||||
Return a titlecased version of B, i.e. ASCII words start with uppercase\n\
|
||||
characters, all remaining cased characters have lowercase.");
|
||||
Return a titlecased version of B, i.e. ASCII words start with\n\
|
||||
uppercase characters, all remaining cased characters have lowercase.");
|
||||
|
||||
void
|
||||
_Py_bytes_title(char *result, const char *s, Py_ssize_t len)
|
||||
|
|
|
|||
|
|
@ -1849,12 +1849,13 @@ bytes___bytes___impl(PyBytesObject *self)
|
|||
#define BOTHSTRIP 2
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_summary
|
||||
bytes.split
|
||||
|
||||
sep: object = None
|
||||
The delimiter according which to split the bytes.
|
||||
None (the default value) means split on ASCII whitespace characters
|
||||
(space, tab, return, newline, formfeed, vertical tab).
|
||||
None (the default value) means split on ASCII whitespace
|
||||
characters (space, tab, return, newline, formfeed, vertical tab).
|
||||
maxsplit: Py_ssize_t = -1
|
||||
Maximum number of splits to do.
|
||||
-1 (the default value) means no limit.
|
||||
|
|
@ -1864,7 +1865,7 @@ Return a list of the sections in the bytes, using sep as the delimiter.
|
|||
|
||||
static PyObject *
|
||||
bytes_split_impl(PyBytesObject *self, PyObject *sep, Py_ssize_t maxsplit)
|
||||
/*[clinic end generated code: output=52126b5844c1d8ef input=8b809b39074abbfa]*/
|
||||
/*[clinic end generated code: output=52126b5844c1d8ef input=330ff95d92544b05]*/
|
||||
{
|
||||
Py_ssize_t len = PyBytes_GET_SIZE(self), n;
|
||||
const char *s = PyBytes_AS_STRING(self), *sub;
|
||||
|
|
@ -1886,7 +1887,6 @@ bytes_split_impl(PyBytesObject *self, PyObject *sep, Py_ssize_t maxsplit)
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_docstring_body
|
||||
bytes.partition
|
||||
|
||||
sep: Py_buffer
|
||||
|
|
@ -1894,17 +1894,17 @@ bytes.partition
|
|||
|
||||
Partition the bytes into three parts using the given separator.
|
||||
|
||||
This will search for the separator sep in the bytes. If the separator is found,
|
||||
returns a 3-tuple containing the part before the separator, the separator
|
||||
itself, and the part after it.
|
||||
This will search for the separator sep in the bytes. If the
|
||||
separator is found, returns a 3-tuple containing the part before the
|
||||
separator, the separator itself, and the part after it.
|
||||
|
||||
If the separator is not found, returns a 3-tuple containing the original bytes
|
||||
object and two empty bytes objects.
|
||||
If the separator is not found, returns a 3-tuple containing the
|
||||
original bytes object and two empty bytes objects.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bytes_partition_impl(PyBytesObject *self, Py_buffer *sep)
|
||||
/*[clinic end generated code: output=f532b392a17ff695 input=31c55a0cebaf7722]*/
|
||||
/*[clinic end generated code: output=f532b392a17ff695 input=2e6e551ea4f8b95a]*/
|
||||
{
|
||||
return stringlib_partition(
|
||||
(PyObject*) self,
|
||||
|
|
@ -1914,7 +1914,6 @@ bytes_partition_impl(PyBytesObject *self, Py_buffer *sep)
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_docstring_body
|
||||
bytes.rpartition
|
||||
|
||||
sep: Py_buffer
|
||||
|
|
@ -1922,17 +1921,18 @@ bytes.rpartition
|
|||
|
||||
Partition the bytes into three parts using the given separator.
|
||||
|
||||
This will search for the separator sep in the bytes, starting at the end. If
|
||||
the separator is found, returns a 3-tuple containing the part before the
|
||||
separator, the separator itself, and the part after it.
|
||||
This will search for the separator sep in the bytes, starting at the
|
||||
end. If the separator is found, returns a 3-tuple containing the
|
||||
part before the separator, the separator itself, and the part after
|
||||
it.
|
||||
|
||||
If the separator is not found, returns a 3-tuple containing two empty bytes
|
||||
objects and the original bytes object.
|
||||
If the separator is not found, returns a 3-tuple containing two
|
||||
empty bytes objects and the original bytes object.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bytes_rpartition_impl(PyBytesObject *self, Py_buffer *sep)
|
||||
/*[clinic end generated code: output=191b114cbb028e50 input=9ea5a3ab0b02bf52]*/
|
||||
/*[clinic end generated code: output=191b114cbb028e50 input=f7d24f722a5470a4]*/
|
||||
{
|
||||
return stringlib_rpartition(
|
||||
(PyObject*) self,
|
||||
|
|
@ -1942,17 +1942,18 @@ bytes_rpartition_impl(PyBytesObject *self, Py_buffer *sep)
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_docstring_body
|
||||
@permit_long_summary
|
||||
bytes.rsplit = bytes.split
|
||||
|
||||
Return a list of the sections in the bytes, using sep as the delimiter.
|
||||
|
||||
Splitting is done starting at the end of the bytes and working to the front.
|
||||
Splitting is done starting at the end of the bytes and working to
|
||||
the front.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bytes_rsplit_impl(PyBytesObject *self, PyObject *sep, Py_ssize_t maxsplit)
|
||||
/*[clinic end generated code: output=ba698d9ea01e1c8f input=55b6eaea1f3d7046]*/
|
||||
/*[clinic end generated code: output=ba698d9ea01e1c8f input=ba9bee56285f43e4]*/
|
||||
{
|
||||
Py_ssize_t len = PyBytes_GET_SIZE(self), n;
|
||||
const char *s = PyBytes_AS_STRING(self), *sub;
|
||||
|
|
@ -2172,7 +2173,6 @@ do_argstrip(PyBytesObject *self, int striptype, PyObject *bytes)
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_docstring_body
|
||||
bytes.strip
|
||||
|
||||
bytes: object = None
|
||||
|
|
@ -2180,12 +2180,13 @@ bytes.strip
|
|||
|
||||
Strip leading and trailing bytes contained in the argument.
|
||||
|
||||
If the argument is omitted or None, strip leading and trailing ASCII whitespace.
|
||||
If the argument is omitted or None, strip leading and trailing ASCII
|
||||
whitespace.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bytes_strip_impl(PyBytesObject *self, PyObject *bytes)
|
||||
/*[clinic end generated code: output=c7c228d3bd104a1b input=71904cd278c0ee03]*/
|
||||
/*[clinic end generated code: output=c7c228d3bd104a1b input=9ffea5f752032bd0]*/
|
||||
{
|
||||
return do_argstrip(self, BOTHSTRIP, bytes);
|
||||
}
|
||||
|
|
@ -2245,6 +2246,7 @@ bytes_count_impl(PyBytesObject *self, PyObject *sub, Py_ssize_t start,
|
|||
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_summary
|
||||
bytes.translate
|
||||
|
||||
table: object
|
||||
|
|
@ -2254,14 +2256,15 @@ bytes.translate
|
|||
|
||||
Return a copy with each character mapped by the given translation table.
|
||||
|
||||
All characters occurring in the optional argument delete are removed.
|
||||
The remaining characters are mapped through the given translation table.
|
||||
All characters occurring in the optional argument delete are
|
||||
removed. The remaining characters are mapped through the given
|
||||
translation table.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bytes_translate_impl(PyBytesObject *self, PyObject *table,
|
||||
PyObject *deletechars)
|
||||
/*[clinic end generated code: output=43be3437f1956211 input=0ecdf159f654233c]*/
|
||||
/*[clinic end generated code: output=43be3437f1956211 input=bddcdef0a87895d2]*/
|
||||
{
|
||||
const char *input;
|
||||
char *output;
|
||||
|
|
@ -2379,7 +2382,6 @@ bytes_translate_impl(PyBytesObject *self, PyObject *table,
|
|||
/*[clinic input]
|
||||
|
||||
@permit_long_summary
|
||||
@permit_long_docstring_body
|
||||
@staticmethod
|
||||
bytes.maketrans
|
||||
|
||||
|
|
@ -2389,15 +2391,15 @@ bytes.maketrans
|
|||
|
||||
Return a translation table usable for the bytes or bytearray translate method.
|
||||
|
||||
The returned table will be one where each byte in frm is mapped to the byte at
|
||||
the same position in to.
|
||||
The returned table will be one where each byte in frm is mapped to
|
||||
the byte at the same position in to.
|
||||
|
||||
The bytes objects frm and to must be of the same length.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bytes_maketrans_impl(Py_buffer *frm, Py_buffer *to)
|
||||
/*[clinic end generated code: output=a36f6399d4b77f6f input=a06b75f44d933fb3]*/
|
||||
/*[clinic end generated code: output=a36f6399d4b77f6f input=3a577e5badfea8f7]*/
|
||||
{
|
||||
return _Py_bytes_maketrans(frm, to);
|
||||
}
|
||||
|
|
@ -2432,6 +2434,7 @@ bytes_replace_impl(PyBytesObject *self, Py_buffer *old, Py_buffer *new,
|
|||
/** End DALKE **/
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_summary
|
||||
bytes.removeprefix as bytes_removeprefix
|
||||
|
||||
prefix: Py_buffer
|
||||
|
|
@ -2439,13 +2442,14 @@ bytes.removeprefix as bytes_removeprefix
|
|||
|
||||
Return a bytes object with the given prefix string removed if present.
|
||||
|
||||
If the bytes starts with the prefix string, return bytes[len(prefix):].
|
||||
Otherwise, return a copy of the original bytes.
|
||||
If the bytes starts with the prefix string, return
|
||||
bytes[len(prefix):]. Otherwise, return a copy of the original
|
||||
bytes.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bytes_removeprefix_impl(PyBytesObject *self, Py_buffer *prefix)
|
||||
/*[clinic end generated code: output=f006865331a06ab6 input=0c93bac817a8502c]*/
|
||||
/*[clinic end generated code: output=f006865331a06ab6 input=3a2672bcee61d7a7]*/
|
||||
{
|
||||
const char *self_start = PyBytes_AS_STRING(self);
|
||||
Py_ssize_t self_len = PyBytes_GET_SIZE(self);
|
||||
|
|
@ -2468,6 +2472,7 @@ bytes_removeprefix_impl(PyBytesObject *self, Py_buffer *prefix)
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_summary
|
||||
bytes.removesuffix as bytes_removesuffix
|
||||
|
||||
suffix: Py_buffer
|
||||
|
|
@ -2475,14 +2480,14 @@ bytes.removesuffix as bytes_removesuffix
|
|||
|
||||
Return a bytes object with the given suffix string removed if present.
|
||||
|
||||
If the bytes ends with the suffix string and that suffix is not empty,
|
||||
return bytes[:-len(prefix)]. Otherwise, return a copy of the original
|
||||
bytes.
|
||||
If the bytes ends with the suffix string and that suffix is not
|
||||
empty, return bytes[:-len(prefix)]. Otherwise, return a copy of the
|
||||
original bytes.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bytes_removesuffix_impl(PyBytesObject *self, Py_buffer *suffix)
|
||||
/*[clinic end generated code: output=d887d308e3242eeb input=9f4e1da8c637bbf1]*/
|
||||
/*[clinic end generated code: output=d887d308e3242eeb input=04df5f18a36f69d7]*/
|
||||
{
|
||||
const char *self_start = PyBytes_AS_STRING(self);
|
||||
Py_ssize_t self_len = PyBytes_GET_SIZE(self);
|
||||
|
|
@ -2562,11 +2567,11 @@ bytes.decode
|
|||
encoding: str(c_default="NULL") = 'utf-8'
|
||||
The encoding with which to decode the bytes.
|
||||
errors: str(c_default="NULL") = 'strict'
|
||||
The error handling scheme to use for the handling of decoding errors.
|
||||
The default is 'strict' meaning that decoding errors raise a
|
||||
UnicodeDecodeError. Other possible values are 'ignore' and 'replace'
|
||||
as well as any other name registered with codecs.register_error that
|
||||
can handle UnicodeDecodeErrors.
|
||||
The error handling scheme to use for the handling of decoding
|
||||
errors. The default is 'strict' meaning that decoding errors
|
||||
raise a UnicodeDecodeError. Other possible values are 'ignore'
|
||||
and 'replace' as well as any other name registered with
|
||||
codecs.register_error that can handle UnicodeDecodeErrors.
|
||||
|
||||
Decode the bytes using the codec registered for encoding.
|
||||
[clinic start generated code]*/
|
||||
|
|
@ -2574,27 +2579,27 @@ Decode the bytes using the codec registered for encoding.
|
|||
static PyObject *
|
||||
bytes_decode_impl(PyBytesObject *self, const char *encoding,
|
||||
const char *errors)
|
||||
/*[clinic end generated code: output=5649a53dde27b314 input=958174769d2a40ca]*/
|
||||
/*[clinic end generated code: output=5649a53dde27b314 input=94e9b8524f1d7f37]*/
|
||||
{
|
||||
return PyUnicode_FromEncodedObject((PyObject*)self, encoding, errors);
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_docstring_body
|
||||
@permit_long_summary
|
||||
bytes.splitlines
|
||||
|
||||
keepends: bool = False
|
||||
|
||||
Return a list of the lines in the bytes, breaking at line boundaries.
|
||||
|
||||
Line breaks are not included in the resulting list unless keepends is given and
|
||||
true.
|
||||
Line breaks are not included in the resulting list unless keepends
|
||||
is given and true.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bytes_splitlines_impl(PyBytesObject *self, int keepends)
|
||||
/*[clinic end generated code: output=3484149a5d880ffb input=d17968d2a355fe55]*/
|
||||
/*[clinic end generated code: output=3484149a5d880ffb input=8734672f34430514]*/
|
||||
{
|
||||
return stringlib_splitlines(
|
||||
(PyObject*) self, PyBytes_AS_STRING(self),
|
||||
|
|
@ -2745,8 +2750,8 @@ bytes.hex
|
|||
sep: object = NULL
|
||||
An optional single character or byte to separate hex bytes.
|
||||
bytes_per_sep: Py_ssize_t = 1
|
||||
How many bytes between separators. Positive values count from the
|
||||
right, negative values count from the left.
|
||||
How many bytes between separators. Positive values count from
|
||||
the right, negative values count from the left.
|
||||
|
||||
Create a string of hexadecimal numbers from a bytes object.
|
||||
|
||||
|
|
@ -2764,7 +2769,7 @@ Create a string of hexadecimal numbers from a bytes object.
|
|||
|
||||
static PyObject *
|
||||
bytes_hex_impl(PyBytesObject *self, PyObject *sep, Py_ssize_t bytes_per_sep)
|
||||
/*[clinic end generated code: output=588821f02cb9d8f5 input=bd8eceb755d8230f]*/
|
||||
/*[clinic end generated code: output=588821f02cb9d8f5 input=b8d40cf203d172dc]*/
|
||||
{
|
||||
const char *argbuf = PyBytes_AS_STRING(self);
|
||||
Py_ssize_t arglen = PyBytes_GET_SIZE(self);
|
||||
|
|
|
|||
73
Objects/clinic/bytearrayobject.c.h
generated
73
Objects/clinic/bytearrayobject.c.h
generated
|
|
@ -679,8 +679,9 @@ PyDoc_STRVAR(bytearray_translate__doc__,
|
|||
" table\n"
|
||||
" Translation table, which must be a bytes object of length 256.\n"
|
||||
"\n"
|
||||
"All characters occurring in the optional argument delete are removed.\n"
|
||||
"The remaining characters are mapped through the given translation table.");
|
||||
"All characters occurring in the optional argument delete are\n"
|
||||
"removed. The remaining characters are mapped through the given\n"
|
||||
"translation table.");
|
||||
|
||||
#define BYTEARRAY_TRANSLATE_METHODDEF \
|
||||
{"translate", _PyCFunction_CAST(bytearray_translate), METH_FASTCALL|METH_KEYWORDS, bytearray_translate__doc__},
|
||||
|
|
@ -750,8 +751,8 @@ PyDoc_STRVAR(bytearray_maketrans__doc__,
|
|||
"\n"
|
||||
"Return a translation table usable for the bytes or bytearray translate method.\n"
|
||||
"\n"
|
||||
"The returned table will be one where each byte in frm is mapped to the byte at\n"
|
||||
"the same position in to.\n"
|
||||
"The returned table will be one where each byte in frm is mapped to\n"
|
||||
"the byte at the same position in to.\n"
|
||||
"\n"
|
||||
"The bytes objects frm and to must be of the same length.");
|
||||
|
||||
|
|
@ -901,8 +902,8 @@ PyDoc_STRVAR(bytearray_split__doc__,
|
|||
"\n"
|
||||
" sep\n"
|
||||
" The delimiter according which to split the bytearray.\n"
|
||||
" None (the default value) means split on ASCII whitespace characters\n"
|
||||
" (space, tab, return, newline, formfeed, vertical tab).\n"
|
||||
" None (the default value) means split on ASCII whitespace\n"
|
||||
" characters (space, tab, return, newline, formfeed, vertical tab).\n"
|
||||
" maxsplit\n"
|
||||
" Maximum number of splits to do.\n"
|
||||
" -1 (the default value) means no limit.");
|
||||
|
|
@ -991,12 +992,13 @@ PyDoc_STRVAR(bytearray_partition__doc__,
|
|||
"\n"
|
||||
"Partition the bytearray into three parts using the given separator.\n"
|
||||
"\n"
|
||||
"This will search for the separator sep in the bytearray. If the separator is\n"
|
||||
"found, returns a 3-tuple containing the part before the separator, the\n"
|
||||
"separator itself, and the part after it as new bytearray objects.\n"
|
||||
"This will search for the separator sep in the bytearray. If the\n"
|
||||
"separator is found, returns a 3-tuple containing the part before the\n"
|
||||
"separator, the separator itself, and the part after it as new\n"
|
||||
"bytearray objects.\n"
|
||||
"\n"
|
||||
"If the separator is not found, returns a 3-tuple containing the copy of the\n"
|
||||
"original bytearray object and two empty bytearray objects.");
|
||||
"If the separator is not found, returns a 3-tuple containing the copy\n"
|
||||
"of the original bytearray object and two empty bytearray objects.");
|
||||
|
||||
#define BYTEARRAY_PARTITION_METHODDEF \
|
||||
{"partition", (PyCFunction)bytearray_partition, METH_O, bytearray_partition__doc__},
|
||||
|
|
@ -1022,13 +1024,14 @@ PyDoc_STRVAR(bytearray_rpartition__doc__,
|
|||
"\n"
|
||||
"Partition the bytearray into three parts using the given separator.\n"
|
||||
"\n"
|
||||
"This will search for the separator sep in the bytearray, starting at the end.\n"
|
||||
"If the separator is found, returns a 3-tuple containing the part before the\n"
|
||||
"separator, the separator itself, and the part after it as new bytearray\n"
|
||||
"objects.\n"
|
||||
"This will search for the separator sep in the bytearray, starting at\n"
|
||||
"the end. If the separator is found, returns a 3-tuple containing\n"
|
||||
"the part before the separator, the separator itself, and the part\n"
|
||||
"after it as new bytearray objects.\n"
|
||||
"\n"
|
||||
"If the separator is not found, returns a 3-tuple containing two empty bytearray\n"
|
||||
"objects and the copy of the original bytearray object.");
|
||||
"If the separator is not found, returns a 3-tuple containing two\n"
|
||||
"empty bytearray objects and the copy of the original bytearray\n"
|
||||
"object.");
|
||||
|
||||
#define BYTEARRAY_RPARTITION_METHODDEF \
|
||||
{"rpartition", (PyCFunction)bytearray_rpartition, METH_O, bytearray_rpartition__doc__},
|
||||
|
|
@ -1056,13 +1059,14 @@ PyDoc_STRVAR(bytearray_rsplit__doc__,
|
|||
"\n"
|
||||
" sep\n"
|
||||
" The delimiter according which to split the bytearray.\n"
|
||||
" None (the default value) means split on ASCII whitespace characters\n"
|
||||
" (space, tab, return, newline, formfeed, vertical tab).\n"
|
||||
" None (the default value) means split on ASCII whitespace\n"
|
||||
" characters (space, tab, return, newline, formfeed, vertical tab).\n"
|
||||
" maxsplit\n"
|
||||
" Maximum number of splits to do.\n"
|
||||
" -1 (the default value) means no limit.\n"
|
||||
"\n"
|
||||
"Splitting is done starting at the end of the bytearray and working to the front.");
|
||||
"Splitting is done starting at the end of the bytearray and working\n"
|
||||
"to the front.");
|
||||
|
||||
#define BYTEARRAY_RSPLIT_METHODDEF \
|
||||
{"rsplit", _PyCFunction_CAST(bytearray_rsplit), METH_FASTCALL|METH_KEYWORDS, bytearray_rsplit__doc__},
|
||||
|
|
@ -1364,7 +1368,8 @@ PyDoc_STRVAR(bytearray_strip__doc__,
|
|||
"\n"
|
||||
"Strip leading and trailing bytes contained in the argument.\n"
|
||||
"\n"
|
||||
"If the argument is omitted or None, strip leading and trailing ASCII whitespace.");
|
||||
"If the argument is omitted or None, strip leading and trailing ASCII\n"
|
||||
"whitespace.");
|
||||
|
||||
#define BYTEARRAY_STRIP_METHODDEF \
|
||||
{"strip", _PyCFunction_CAST(bytearray_strip), METH_FASTCALL, bytearray_strip__doc__},
|
||||
|
|
@ -1475,11 +1480,11 @@ PyDoc_STRVAR(bytearray_decode__doc__,
|
|||
" encoding\n"
|
||||
" The encoding with which to decode the bytearray.\n"
|
||||
" errors\n"
|
||||
" The error handling scheme to use for the handling of decoding errors.\n"
|
||||
" The default is \'strict\' meaning that decoding errors raise a\n"
|
||||
" UnicodeDecodeError. Other possible values are \'ignore\' and \'replace\'\n"
|
||||
" as well as any other name registered with codecs.register_error that\n"
|
||||
" can handle UnicodeDecodeErrors.");
|
||||
" The error handling scheme to use for the handling of decoding\n"
|
||||
" errors. The default is \'strict\' meaning that decoding errors\n"
|
||||
" raise a UnicodeDecodeError. Other possible values are \'ignore\'\n"
|
||||
" and \'replace\' as well as any other name registered with\n"
|
||||
" codecs.register_error that can handle UnicodeDecodeErrors.");
|
||||
|
||||
#define BYTEARRAY_DECODE_METHODDEF \
|
||||
{"decode", _PyCFunction_CAST(bytearray_decode), METH_FASTCALL|METH_KEYWORDS, bytearray_decode__doc__},
|
||||
|
|
@ -1578,7 +1583,8 @@ PyDoc_STRVAR(bytearray_join__doc__,
|
|||
"\n"
|
||||
"Concatenate any number of bytes/bytearray objects.\n"
|
||||
"\n"
|
||||
"The bytearray whose method is called is inserted in between each pair.\n"
|
||||
"The bytearray whose method is called is inserted in between each\n"
|
||||
"pair.\n"
|
||||
"\n"
|
||||
"The result is returned as a new bytearray object.");
|
||||
|
||||
|
|
@ -1606,8 +1612,8 @@ PyDoc_STRVAR(bytearray_splitlines__doc__,
|
|||
"\n"
|
||||
"Return a list of the lines in the bytearray, breaking at line boundaries.\n"
|
||||
"\n"
|
||||
"Line breaks are not included in the resulting list unless keepends is given and\n"
|
||||
"true.");
|
||||
"Line breaks are not included in the resulting list unless keepends\n"
|
||||
"is given and true.");
|
||||
|
||||
#define BYTEARRAY_SPLITLINES_METHODDEF \
|
||||
{"splitlines", _PyCFunction_CAST(bytearray_splitlines), METH_FASTCALL|METH_KEYWORDS, bytearray_splitlines__doc__},
|
||||
|
|
@ -1678,7 +1684,8 @@ PyDoc_STRVAR(bytearray_fromhex__doc__,
|
|||
"Create a bytearray object from a string of hexadecimal numbers.\n"
|
||||
"\n"
|
||||
"Spaces between two numbers are accepted.\n"
|
||||
"Example: bytearray.fromhex(\'B9 01EF\') -> bytearray(b\'\\\\xb9\\\\x01\\\\xef\')");
|
||||
"Example:\n"
|
||||
" bytearray.fromhex(\'B9 01EF\') -> bytearray(b\'\\\\xb9\\\\x01\\\\xef\')");
|
||||
|
||||
#define BYTEARRAY_FROMHEX_METHODDEF \
|
||||
{"fromhex", (PyCFunction)bytearray_fromhex, METH_O|METH_CLASS, bytearray_fromhex__doc__},
|
||||
|
|
@ -1705,8 +1712,8 @@ PyDoc_STRVAR(bytearray_hex__doc__,
|
|||
" sep\n"
|
||||
" An optional single character or byte to separate hex bytes.\n"
|
||||
" bytes_per_sep\n"
|
||||
" How many bytes between separators. Positive values count from the\n"
|
||||
" right, negative values count from the left.\n"
|
||||
" How many bytes between separators. Positive values count from\n"
|
||||
" the right, negative values count from the left.\n"
|
||||
"\n"
|
||||
"Example:\n"
|
||||
">>> value = bytearray([0xb9, 0x01, 0xef])\n"
|
||||
|
|
@ -1875,4 +1882,4 @@ bytearray_sizeof(PyObject *self, PyObject *Py_UNUSED(ignored))
|
|||
{
|
||||
return bytearray_sizeof_impl((PyByteArrayObject *)self);
|
||||
}
|
||||
/*[clinic end generated code: output=2cacb323147202b9 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=6dc315d35de3e670 input=a9049054013a1b77]*/
|
||||
|
|
|
|||
75
Objects/clinic/bytesobject.c.h
generated
75
Objects/clinic/bytesobject.c.h
generated
|
|
@ -35,8 +35,8 @@ PyDoc_STRVAR(bytes_split__doc__,
|
|||
"\n"
|
||||
" sep\n"
|
||||
" The delimiter according which to split the bytes.\n"
|
||||
" None (the default value) means split on ASCII whitespace characters\n"
|
||||
" (space, tab, return, newline, formfeed, vertical tab).\n"
|
||||
" None (the default value) means split on ASCII whitespace\n"
|
||||
" characters (space, tab, return, newline, formfeed, vertical tab).\n"
|
||||
" maxsplit\n"
|
||||
" Maximum number of splits to do.\n"
|
||||
" -1 (the default value) means no limit.");
|
||||
|
|
@ -122,12 +122,12 @@ PyDoc_STRVAR(bytes_partition__doc__,
|
|||
"\n"
|
||||
"Partition the bytes into three parts using the given separator.\n"
|
||||
"\n"
|
||||
"This will search for the separator sep in the bytes. If the separator is found,\n"
|
||||
"returns a 3-tuple containing the part before the separator, the separator\n"
|
||||
"itself, and the part after it.\n"
|
||||
"This will search for the separator sep in the bytes. If the\n"
|
||||
"separator is found, returns a 3-tuple containing the part before the\n"
|
||||
"separator, the separator itself, and the part after it.\n"
|
||||
"\n"
|
||||
"If the separator is not found, returns a 3-tuple containing the original bytes\n"
|
||||
"object and two empty bytes objects.");
|
||||
"If the separator is not found, returns a 3-tuple containing the\n"
|
||||
"original bytes object and two empty bytes objects.");
|
||||
|
||||
#define BYTES_PARTITION_METHODDEF \
|
||||
{"partition", (PyCFunction)bytes_partition, METH_O, bytes_partition__doc__},
|
||||
|
|
@ -161,12 +161,13 @@ PyDoc_STRVAR(bytes_rpartition__doc__,
|
|||
"\n"
|
||||
"Partition the bytes into three parts using the given separator.\n"
|
||||
"\n"
|
||||
"This will search for the separator sep in the bytes, starting at the end. If\n"
|
||||
"the separator is found, returns a 3-tuple containing the part before the\n"
|
||||
"separator, the separator itself, and the part after it.\n"
|
||||
"This will search for the separator sep in the bytes, starting at the\n"
|
||||
"end. If the separator is found, returns a 3-tuple containing the\n"
|
||||
"part before the separator, the separator itself, and the part after\n"
|
||||
"it.\n"
|
||||
"\n"
|
||||
"If the separator is not found, returns a 3-tuple containing two empty bytes\n"
|
||||
"objects and the original bytes object.");
|
||||
"If the separator is not found, returns a 3-tuple containing two\n"
|
||||
"empty bytes objects and the original bytes object.");
|
||||
|
||||
#define BYTES_RPARTITION_METHODDEF \
|
||||
{"rpartition", (PyCFunction)bytes_rpartition, METH_O, bytes_rpartition__doc__},
|
||||
|
|
@ -202,13 +203,14 @@ PyDoc_STRVAR(bytes_rsplit__doc__,
|
|||
"\n"
|
||||
" sep\n"
|
||||
" The delimiter according which to split the bytes.\n"
|
||||
" None (the default value) means split on ASCII whitespace characters\n"
|
||||
" (space, tab, return, newline, formfeed, vertical tab).\n"
|
||||
" None (the default value) means split on ASCII whitespace\n"
|
||||
" characters (space, tab, return, newline, formfeed, vertical tab).\n"
|
||||
" maxsplit\n"
|
||||
" Maximum number of splits to do.\n"
|
||||
" -1 (the default value) means no limit.\n"
|
||||
"\n"
|
||||
"Splitting is done starting at the end of the bytes and working to the front.");
|
||||
"Splitting is done starting at the end of the bytes and working to\n"
|
||||
"the front.");
|
||||
|
||||
#define BYTES_RSPLIT_METHODDEF \
|
||||
{"rsplit", _PyCFunction_CAST(bytes_rsplit), METH_FASTCALL|METH_KEYWORDS, bytes_rsplit__doc__},
|
||||
|
|
@ -523,7 +525,8 @@ PyDoc_STRVAR(bytes_strip__doc__,
|
|||
"\n"
|
||||
"Strip leading and trailing bytes contained in the argument.\n"
|
||||
"\n"
|
||||
"If the argument is omitted or None, strip leading and trailing ASCII whitespace.");
|
||||
"If the argument is omitted or None, strip leading and trailing ASCII\n"
|
||||
"whitespace.");
|
||||
|
||||
#define BYTES_STRIP_METHODDEF \
|
||||
{"strip", _PyCFunction_CAST(bytes_strip), METH_FASTCALL, bytes_strip__doc__},
|
||||
|
|
@ -677,8 +680,9 @@ PyDoc_STRVAR(bytes_translate__doc__,
|
|||
" table\n"
|
||||
" Translation table, which must be a bytes object of length 256.\n"
|
||||
"\n"
|
||||
"All characters occurring in the optional argument delete are removed.\n"
|
||||
"The remaining characters are mapped through the given translation table.");
|
||||
"All characters occurring in the optional argument delete are\n"
|
||||
"removed. The remaining characters are mapped through the given\n"
|
||||
"translation table.");
|
||||
|
||||
#define BYTES_TRANSLATE_METHODDEF \
|
||||
{"translate", _PyCFunction_CAST(bytes_translate), METH_FASTCALL|METH_KEYWORDS, bytes_translate__doc__},
|
||||
|
|
@ -746,8 +750,8 @@ PyDoc_STRVAR(bytes_maketrans__doc__,
|
|||
"\n"
|
||||
"Return a translation table usable for the bytes or bytearray translate method.\n"
|
||||
"\n"
|
||||
"The returned table will be one where each byte in frm is mapped to the byte at\n"
|
||||
"the same position in to.\n"
|
||||
"The returned table will be one where each byte in frm is mapped to\n"
|
||||
"the byte at the same position in to.\n"
|
||||
"\n"
|
||||
"The bytes objects frm and to must be of the same length.");
|
||||
|
||||
|
|
@ -893,8 +897,9 @@ PyDoc_STRVAR(bytes_removeprefix__doc__,
|
|||
"\n"
|
||||
"Return a bytes object with the given prefix string removed if present.\n"
|
||||
"\n"
|
||||
"If the bytes starts with the prefix string, return bytes[len(prefix):].\n"
|
||||
"Otherwise, return a copy of the original bytes.");
|
||||
"If the bytes starts with the prefix string, return\n"
|
||||
"bytes[len(prefix):]. Otherwise, return a copy of the original\n"
|
||||
"bytes.");
|
||||
|
||||
#define BYTES_REMOVEPREFIX_METHODDEF \
|
||||
{"removeprefix", (PyCFunction)bytes_removeprefix, METH_O, bytes_removeprefix__doc__},
|
||||
|
|
@ -928,9 +933,9 @@ PyDoc_STRVAR(bytes_removesuffix__doc__,
|
|||
"\n"
|
||||
"Return a bytes object with the given suffix string removed if present.\n"
|
||||
"\n"
|
||||
"If the bytes ends with the suffix string and that suffix is not empty,\n"
|
||||
"return bytes[:-len(prefix)]. Otherwise, return a copy of the original\n"
|
||||
"bytes.");
|
||||
"If the bytes ends with the suffix string and that suffix is not\n"
|
||||
"empty, return bytes[:-len(prefix)]. Otherwise, return a copy of the\n"
|
||||
"original bytes.");
|
||||
|
||||
#define BYTES_REMOVESUFFIX_METHODDEF \
|
||||
{"removesuffix", (PyCFunction)bytes_removesuffix, METH_O, bytes_removesuffix__doc__},
|
||||
|
|
@ -1069,11 +1074,11 @@ PyDoc_STRVAR(bytes_decode__doc__,
|
|||
" encoding\n"
|
||||
" The encoding with which to decode the bytes.\n"
|
||||
" errors\n"
|
||||
" The error handling scheme to use for the handling of decoding errors.\n"
|
||||
" The default is \'strict\' meaning that decoding errors raise a\n"
|
||||
" UnicodeDecodeError. Other possible values are \'ignore\' and \'replace\'\n"
|
||||
" as well as any other name registered with codecs.register_error that\n"
|
||||
" can handle UnicodeDecodeErrors.");
|
||||
" The error handling scheme to use for the handling of decoding\n"
|
||||
" errors. The default is \'strict\' meaning that decoding errors\n"
|
||||
" raise a UnicodeDecodeError. Other possible values are \'ignore\'\n"
|
||||
" and \'replace\' as well as any other name registered with\n"
|
||||
" codecs.register_error that can handle UnicodeDecodeErrors.");
|
||||
|
||||
#define BYTES_DECODE_METHODDEF \
|
||||
{"decode", _PyCFunction_CAST(bytes_decode), METH_FASTCALL|METH_KEYWORDS, bytes_decode__doc__},
|
||||
|
|
@ -1170,8 +1175,8 @@ PyDoc_STRVAR(bytes_splitlines__doc__,
|
|||
"\n"
|
||||
"Return a list of the lines in the bytes, breaking at line boundaries.\n"
|
||||
"\n"
|
||||
"Line breaks are not included in the resulting list unless keepends is given and\n"
|
||||
"true.");
|
||||
"Line breaks are not included in the resulting list unless keepends\n"
|
||||
"is given and true.");
|
||||
|
||||
#define BYTES_SPLITLINES_METHODDEF \
|
||||
{"splitlines", _PyCFunction_CAST(bytes_splitlines), METH_FASTCALL|METH_KEYWORDS, bytes_splitlines__doc__},
|
||||
|
|
@ -1267,8 +1272,8 @@ PyDoc_STRVAR(bytes_hex__doc__,
|
|||
" sep\n"
|
||||
" An optional single character or byte to separate hex bytes.\n"
|
||||
" bytes_per_sep\n"
|
||||
" How many bytes between separators. Positive values count from the\n"
|
||||
" right, negative values count from the left.\n"
|
||||
" How many bytes between separators. Positive values count from\n"
|
||||
" the right, negative values count from the left.\n"
|
||||
"\n"
|
||||
"Example:\n"
|
||||
">>> value = b\'\\xb9\\x01\\xef\'\n"
|
||||
|
|
@ -1450,4 +1455,4 @@ skip_optional_pos:
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=b252801ff04a89b3 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=c20458db7a2123db input=a9049054013a1b77]*/
|
||||
|
|
|
|||
5
Objects/clinic/codeobject.c.h
generated
5
Objects/clinic/codeobject.c.h
generated
|
|
@ -414,7 +414,8 @@ PyDoc_STRVAR(code__varname_from_oparg__doc__,
|
|||
"\n"
|
||||
"(internal-only) Return the local variable name for the given oparg.\n"
|
||||
"\n"
|
||||
"WARNING: this method is for internal use only and may change or go away.");
|
||||
"WARNING: this method is for internal use only and may change or go\n"
|
||||
"away.");
|
||||
|
||||
#define CODE__VARNAME_FROM_OPARG_METHODDEF \
|
||||
{"_varname_from_oparg", _PyCFunction_CAST(code__varname_from_oparg), METH_FASTCALL|METH_KEYWORDS, code__varname_from_oparg__doc__},
|
||||
|
|
@ -470,4 +471,4 @@ code__varname_from_oparg(PyObject *self, PyObject *const *args, Py_ssize_t nargs
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=c5c6e40fc357defe input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=5c22e29e430401b4 input=a9049054013a1b77]*/
|
||||
|
|
|
|||
6
Objects/clinic/floatobject.c.h
generated
6
Objects/clinic/floatobject.c.h
generated
|
|
@ -291,8 +291,8 @@ PyDoc_STRVAR(float___getformat____doc__,
|
|||
"It exists mainly to be used in Python\'s test suite.\n"
|
||||
"\n"
|
||||
"This function returns whichever of \'IEEE, big-endian\' or \'IEEE,\n"
|
||||
"little-endian\' best describes the format of floating-point numbers used by the\n"
|
||||
"C type named by typestr.");
|
||||
"little-endian\' best describes the format of floating-point numbers\n"
|
||||
"used by the C type named by typestr.");
|
||||
|
||||
#define FLOAT___GETFORMAT___METHODDEF \
|
||||
{"__getformat__", (PyCFunction)float___getformat__, METH_O|METH_CLASS, float___getformat____doc__},
|
||||
|
|
@ -353,4 +353,4 @@ float___format__(PyObject *self, PyObject *arg)
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=f0b2af257213c8b0 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=5d7b0bf9e47ff997 input=a9049054013a1b77]*/
|
||||
|
|
|
|||
10
Objects/clinic/listobject.c.h
generated
10
Objects/clinic/listobject.c.h
generated
|
|
@ -200,11 +200,11 @@ PyDoc_STRVAR(list_sort__doc__,
|
|||
"\n"
|
||||
"Sort the list in ascending order and return None.\n"
|
||||
"\n"
|
||||
"The sort is in-place (i.e. the list itself is modified) and stable (i.e. the\n"
|
||||
"order of two equal elements is maintained).\n"
|
||||
"The sort is in-place (i.e. the list itself is modified) and stable\n"
|
||||
"(i.e. the order of two equal elements is maintained).\n"
|
||||
"\n"
|
||||
"If a key function is given, apply it once to each list item and sort them,\n"
|
||||
"ascending or descending, according to their function values.\n"
|
||||
"If a key function is given, apply it once to each list item and sort\n"
|
||||
"them, ascending or descending, according to their function values.\n"
|
||||
"\n"
|
||||
"The reverse flag can be set to sort in descending order.");
|
||||
|
||||
|
|
@ -468,4 +468,4 @@ list___reversed__(PyObject *self, PyObject *Py_UNUSED(ignored))
|
|||
{
|
||||
return list___reversed___impl((PyListObject *)self);
|
||||
}
|
||||
/*[clinic end generated code: output=ae13fc2b56dc27c2 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=06c21b0bffbe8d84 input=a9049054013a1b77]*/
|
||||
|
|
|
|||
45
Objects/clinic/longobject.c.h
generated
45
Objects/clinic/longobject.c.h
generated
|
|
@ -262,19 +262,20 @@ PyDoc_STRVAR(int_to_bytes__doc__,
|
|||
"Return an array of bytes representing an integer.\n"
|
||||
"\n"
|
||||
" length\n"
|
||||
" Length of bytes object to use. An OverflowError is raised if the\n"
|
||||
" integer is not representable with the given number of bytes. Default\n"
|
||||
" is length 1.\n"
|
||||
" Length of bytes object to use. An OverflowError is raised if\n"
|
||||
" the integer is not representable with the given number of bytes.\n"
|
||||
" Default is length 1.\n"
|
||||
" byteorder\n"
|
||||
" The byte order used to represent the integer. If byteorder is \'big\',\n"
|
||||
" the most significant byte is at the beginning of the byte array. If\n"
|
||||
" byteorder is \'little\', the most significant byte is at the end of the\n"
|
||||
" byte array. To request the native byte order of the host system, use\n"
|
||||
" sys.byteorder as the byte order value. Default is to use \'big\'.\n"
|
||||
" The byte order used to represent the integer. If byteorder is\n"
|
||||
" \'big\', the most significant byte is at the beginning of the byte\n"
|
||||
" array. If byteorder is \'little\', the most significant byte is at\n"
|
||||
" the end of the byte array. To request the native byte order of\n"
|
||||
" the host system, use sys.byteorder as the byte order value.\n"
|
||||
" Default is to use \'big\'.\n"
|
||||
" signed\n"
|
||||
" Determines whether two\'s complement is used to represent the integer.\n"
|
||||
" If signed is False and a negative integer is given, an OverflowError\n"
|
||||
" is raised.");
|
||||
" Determines whether two\'s complement is used to represent the\n"
|
||||
" integer. If signed is False and a negative integer is given,\n"
|
||||
" an OverflowError is raised.");
|
||||
|
||||
#define INT_TO_BYTES_METHODDEF \
|
||||
{"to_bytes", _PyCFunction_CAST(int_to_bytes), METH_FASTCALL|METH_KEYWORDS, int_to_bytes__doc__},
|
||||
|
|
@ -383,17 +384,19 @@ PyDoc_STRVAR(int_from_bytes__doc__,
|
|||
"\n"
|
||||
" bytes\n"
|
||||
" Holds the array of bytes to convert. The argument must either\n"
|
||||
" support the buffer protocol or be an iterable object producing bytes.\n"
|
||||
" Bytes and bytearray are examples of built-in objects that support the\n"
|
||||
" buffer protocol.\n"
|
||||
" support the buffer protocol or be an iterable object producing\n"
|
||||
" bytes. Bytes and bytearray are examples of built-in objects that\n"
|
||||
" support the buffer protocol.\n"
|
||||
" byteorder\n"
|
||||
" The byte order used to represent the integer. If byteorder is \'big\',\n"
|
||||
" the most significant byte is at the beginning of the byte array. If\n"
|
||||
" byteorder is \'little\', the most significant byte is at the end of the\n"
|
||||
" byte array. To request the native byte order of the host system, use\n"
|
||||
" sys.byteorder as the byte order value. Default is to use \'big\'.\n"
|
||||
" The byte order used to represent the integer. If byteorder is\n"
|
||||
" \'big\', the most significant byte is at the beginning of the byte\n"
|
||||
" array. If byteorder is \'little\', the most significant byte is at\n"
|
||||
" the end of the byte array. To request the native byte order of\n"
|
||||
" the host system, use sys.byteorder as the byte order value.\n"
|
||||
" Default is to use \'big\'.\n"
|
||||
" signed\n"
|
||||
" Indicates whether two\'s complement is used to represent the integer.");
|
||||
" Indicates whether two\'s complement is used to represent the\n"
|
||||
" integer.");
|
||||
|
||||
#define INT_FROM_BYTES_METHODDEF \
|
||||
{"from_bytes", _PyCFunction_CAST(int_from_bytes), METH_FASTCALL|METH_KEYWORDS|METH_CLASS, int_from_bytes__doc__},
|
||||
|
|
@ -490,4 +493,4 @@ int_is_integer(PyObject *self, PyObject *Py_UNUSED(ignored))
|
|||
{
|
||||
return int_is_integer_impl(self);
|
||||
}
|
||||
/*[clinic end generated code: output=e68f4e23ead3f649 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=d95766fb7ff46963 input=a9049054013a1b77]*/
|
||||
|
|
|
|||
17
Objects/clinic/memoryobject.c.h
generated
17
Objects/clinic/memoryobject.c.h
generated
|
|
@ -259,11 +259,12 @@ PyDoc_STRVAR(memoryview_tobytes__doc__,
|
|||
"\n"
|
||||
"Return the data in the buffer as a byte string.\n"
|
||||
"\n"
|
||||
"Order can be {\'C\', \'F\', \'A\'}. When order is \'C\' or \'F\', the data of the\n"
|
||||
"original array is converted to C or Fortran order. For contiguous views,\n"
|
||||
"\'A\' returns an exact copy of the physical memory. In particular, in-memory\n"
|
||||
"Fortran order is preserved. For non-contiguous views, the data is converted\n"
|
||||
"to C first. order=None is the same as order=\'C\'.");
|
||||
"Order can be {\'C\', \'F\', \'A\'}. When order is \'C\' or \'F\', the data of\n"
|
||||
"the original array is converted to C or Fortran order. For\n"
|
||||
"contiguous views, \'A\' returns an exact copy of the physical memory.\n"
|
||||
"In particular, in-memory Fortran order is preserved. For\n"
|
||||
"non-contiguous views, the data is converted to C first. order=None\n"
|
||||
"is the same as order=\'C\'.");
|
||||
|
||||
#define MEMORYVIEW_TOBYTES_METHODDEF \
|
||||
{"tobytes", _PyCFunction_CAST(memoryview_tobytes), METH_FASTCALL|METH_KEYWORDS, memoryview_tobytes__doc__},
|
||||
|
|
@ -348,8 +349,8 @@ PyDoc_STRVAR(memoryview_hex__doc__,
|
|||
" sep\n"
|
||||
" An optional single character or byte to separate hex bytes.\n"
|
||||
" bytes_per_sep\n"
|
||||
" How many bytes between separators. Positive values count from the\n"
|
||||
" right, negative values count from the left.\n"
|
||||
" How many bytes between separators. Positive values count from\n"
|
||||
" the right, negative values count from the left.\n"
|
||||
"\n"
|
||||
"Example:\n"
|
||||
">>> value = memoryview(b\'\\xb9\\x01\\xef\')\n"
|
||||
|
|
@ -505,4 +506,4 @@ skip_optional:
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=348b6ddb98a1f412 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=3abf9c80cd49229a input=a9049054013a1b77]*/
|
||||
|
|
|
|||
5
Objects/clinic/odictobject.c.h
generated
5
Objects/clinic/odictobject.c.h
generated
|
|
@ -268,7 +268,8 @@ PyDoc_STRVAR(OrderedDict_popitem__doc__,
|
|||
"\n"
|
||||
"Remove and return a (key, value) pair from the dictionary.\n"
|
||||
"\n"
|
||||
"Pairs are returned in LIFO order if last is true or FIFO order if false.");
|
||||
"Pairs are returned in LIFO order if last is true or FIFO order if\n"
|
||||
"false.");
|
||||
|
||||
#define ORDEREDDICT_POPITEM_METHODDEF \
|
||||
{"popitem", _PyCFunction_CAST(OrderedDict_popitem), METH_FASTCALL|METH_KEYWORDS, OrderedDict_popitem__doc__},
|
||||
|
|
@ -451,4 +452,4 @@ skip_optional_pos:
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=7bc997ca7900f06f input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=89f7e92de998f9a4 input=a9049054013a1b77]*/
|
||||
|
|
|
|||
162
Objects/clinic/unicodeobject.c.h
generated
162
Objects/clinic/unicodeobject.c.h
generated
|
|
@ -33,8 +33,8 @@ PyDoc_STRVAR(unicode_title__doc__,
|
|||
"\n"
|
||||
"Return a version of the string where each word is titlecased.\n"
|
||||
"\n"
|
||||
"More specifically, words start with uppercased characters and all remaining\n"
|
||||
"cased characters have lower case.");
|
||||
"More specifically, words start with uppercased characters and all\n"
|
||||
"remaining cased characters have lower case.");
|
||||
|
||||
#define UNICODE_TITLE_METHODDEF \
|
||||
{"title", (PyCFunction)unicode_title, METH_NOARGS, unicode_title__doc__},
|
||||
|
|
@ -54,8 +54,8 @@ PyDoc_STRVAR(unicode_capitalize__doc__,
|
|||
"\n"
|
||||
"Return a capitalized version of the string.\n"
|
||||
"\n"
|
||||
"More specifically, make the first character have upper case and the rest lower\n"
|
||||
"case.");
|
||||
"More specifically, make the first character have upper case and the\n"
|
||||
"rest lower case.");
|
||||
|
||||
#define UNICODE_CAPITALIZE_METHODDEF \
|
||||
{"capitalize", (PyCFunction)unicode_capitalize, METH_NOARGS, unicode_capitalize__doc__},
|
||||
|
|
@ -93,7 +93,8 @@ PyDoc_STRVAR(unicode_center__doc__,
|
|||
"\n"
|
||||
"Return a centered string of length width.\n"
|
||||
"\n"
|
||||
"Padding is done using the specified fill character (default is a space).");
|
||||
"Padding is done using the specified fill character (default is\n"
|
||||
"a space).");
|
||||
|
||||
#define UNICODE_CENTER_METHODDEF \
|
||||
{"center", _PyCFunction_CAST(unicode_center), METH_FASTCALL, unicode_center__doc__},
|
||||
|
|
@ -142,7 +143,8 @@ PyDoc_STRVAR(unicode_count__doc__,
|
|||
"\n"
|
||||
"Return the number of non-overlapping occurrences of substring sub in string S[start:end].\n"
|
||||
"\n"
|
||||
"Optional arguments start and end are interpreted as in slice notation.");
|
||||
"Optional arguments start and end are interpreted as in slice\n"
|
||||
"notation.");
|
||||
|
||||
#define UNICODE_COUNT_METHODDEF \
|
||||
{"count", _PyCFunction_CAST(unicode_count), METH_FASTCALL, unicode_count__doc__},
|
||||
|
|
@ -202,8 +204,8 @@ PyDoc_STRVAR(unicode_encode__doc__,
|
|||
" errors\n"
|
||||
" The error handling scheme to use for encoding errors.\n"
|
||||
" The default is \'strict\' meaning that encoding errors raise a\n"
|
||||
" UnicodeEncodeError. Other possible values are \'ignore\', \'replace\' and\n"
|
||||
" \'xmlcharrefreplace\' as well as any other name registered with\n"
|
||||
" UnicodeEncodeError. Other possible values are \'ignore\', \'replace\'\n"
|
||||
" and \'xmlcharrefreplace\' as well as any other name registered with\n"
|
||||
" codecs.register_error that can handle UnicodeEncodeErrors.");
|
||||
|
||||
#define UNICODE_ENCODE_METHODDEF \
|
||||
|
|
@ -368,8 +370,8 @@ PyDoc_STRVAR(unicode_find__doc__,
|
|||
"\n"
|
||||
"Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].\n"
|
||||
"\n"
|
||||
"Optional arguments start and end are interpreted as in slice notation.\n"
|
||||
"Return -1 on failure.");
|
||||
"Optional arguments start and end are interpreted as in slice\n"
|
||||
"notation. Return -1 on failure.");
|
||||
|
||||
#define UNICODE_FIND_METHODDEF \
|
||||
{"find", _PyCFunction_CAST(unicode_find), METH_FASTCALL, unicode_find__doc__},
|
||||
|
|
@ -424,8 +426,8 @@ PyDoc_STRVAR(unicode_index__doc__,
|
|||
"\n"
|
||||
"Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].\n"
|
||||
"\n"
|
||||
"Optional arguments start and end are interpreted as in slice notation.\n"
|
||||
"Raises ValueError when the substring is not found.");
|
||||
"Optional arguments start and end are interpreted as in slice\n"
|
||||
"notation. Raises ValueError when the substring is not found.");
|
||||
|
||||
#define UNICODE_INDEX_METHODDEF \
|
||||
{"index", _PyCFunction_CAST(unicode_index), METH_FASTCALL, unicode_index__doc__},
|
||||
|
|
@ -501,8 +503,8 @@ PyDoc_STRVAR(unicode_islower__doc__,
|
|||
"\n"
|
||||
"Return True if the string is a lowercase string, False otherwise.\n"
|
||||
"\n"
|
||||
"A string is lowercase if all cased characters in the string are lowercase and\n"
|
||||
"there is at least one cased character in the string.");
|
||||
"A string is lowercase if all cased characters in the string are\n"
|
||||
"lowercase and there is at least one cased character in the string.");
|
||||
|
||||
#define UNICODE_ISLOWER_METHODDEF \
|
||||
{"islower", (PyCFunction)unicode_islower, METH_NOARGS, unicode_islower__doc__},
|
||||
|
|
@ -522,8 +524,8 @@ PyDoc_STRVAR(unicode_isupper__doc__,
|
|||
"\n"
|
||||
"Return True if the string is an uppercase string, False otherwise.\n"
|
||||
"\n"
|
||||
"A string is uppercase if all cased characters in the string are uppercase and\n"
|
||||
"there is at least one cased character in the string.");
|
||||
"A string is uppercase if all cased characters in the string are\n"
|
||||
"uppercase and there is at least one cased character in the string.");
|
||||
|
||||
#define UNICODE_ISUPPER_METHODDEF \
|
||||
{"isupper", (PyCFunction)unicode_isupper, METH_NOARGS, unicode_isupper__doc__},
|
||||
|
|
@ -564,8 +566,8 @@ PyDoc_STRVAR(unicode_isspace__doc__,
|
|||
"\n"
|
||||
"Return True if the string is a whitespace string, False otherwise.\n"
|
||||
"\n"
|
||||
"A string is whitespace if all characters in the string are whitespace and there\n"
|
||||
"is at least one character in the string.");
|
||||
"A string is whitespace if all characters in the string are\n"
|
||||
"whitespace and there is at least one character in the string.");
|
||||
|
||||
#define UNICODE_ISSPACE_METHODDEF \
|
||||
{"isspace", (PyCFunction)unicode_isspace, METH_NOARGS, unicode_isspace__doc__},
|
||||
|
|
@ -585,8 +587,8 @@ PyDoc_STRVAR(unicode_isalpha__doc__,
|
|||
"\n"
|
||||
"Return True if the string is an alphabetic string, False otherwise.\n"
|
||||
"\n"
|
||||
"A string is alphabetic if all characters in the string are alphabetic and there\n"
|
||||
"is at least one character in the string.");
|
||||
"A string is alphabetic if all characters in the string are\n"
|
||||
"alphabetic and there is at least one character in the string.");
|
||||
|
||||
#define UNICODE_ISALPHA_METHODDEF \
|
||||
{"isalpha", (PyCFunction)unicode_isalpha, METH_NOARGS, unicode_isalpha__doc__},
|
||||
|
|
@ -606,8 +608,8 @@ PyDoc_STRVAR(unicode_isalnum__doc__,
|
|||
"\n"
|
||||
"Return True if the string is an alpha-numeric string, False otherwise.\n"
|
||||
"\n"
|
||||
"A string is alpha-numeric if all characters in the string are alpha-numeric and\n"
|
||||
"there is at least one character in the string.");
|
||||
"A string is alpha-numeric if all characters in the string are\n"
|
||||
"alpha-numeric and there is at least one character in the string.");
|
||||
|
||||
#define UNICODE_ISALNUM_METHODDEF \
|
||||
{"isalnum", (PyCFunction)unicode_isalnum, METH_NOARGS, unicode_isalnum__doc__},
|
||||
|
|
@ -627,8 +629,8 @@ PyDoc_STRVAR(unicode_isdecimal__doc__,
|
|||
"\n"
|
||||
"Return True if the string is a decimal string, False otherwise.\n"
|
||||
"\n"
|
||||
"A string is a decimal string if all characters in the string are decimal and\n"
|
||||
"there is at least one character in the string.");
|
||||
"A string is a decimal string if all characters in the string are\n"
|
||||
"decimal and there is at least one character in the string.");
|
||||
|
||||
#define UNICODE_ISDECIMAL_METHODDEF \
|
||||
{"isdecimal", (PyCFunction)unicode_isdecimal, METH_NOARGS, unicode_isdecimal__doc__},
|
||||
|
|
@ -648,8 +650,8 @@ PyDoc_STRVAR(unicode_isdigit__doc__,
|
|||
"\n"
|
||||
"Return True if the string is a digit string, False otherwise.\n"
|
||||
"\n"
|
||||
"A string is a digit string if all characters in the string are digits and there\n"
|
||||
"is at least one character in the string.");
|
||||
"A string is a digit string if all characters in the string are\n"
|
||||
"digits and there is at least one character in the string.");
|
||||
|
||||
#define UNICODE_ISDIGIT_METHODDEF \
|
||||
{"isdigit", (PyCFunction)unicode_isdigit, METH_NOARGS, unicode_isdigit__doc__},
|
||||
|
|
@ -669,8 +671,8 @@ PyDoc_STRVAR(unicode_isnumeric__doc__,
|
|||
"\n"
|
||||
"Return True if the string is a numeric string, False otherwise.\n"
|
||||
"\n"
|
||||
"A string is numeric if all characters in the string are numeric and there is at\n"
|
||||
"least one character in the string.");
|
||||
"A string is numeric if all characters in the string are numeric and\n"
|
||||
"there is at least one character in the string.");
|
||||
|
||||
#define UNICODE_ISNUMERIC_METHODDEF \
|
||||
{"isnumeric", (PyCFunction)unicode_isnumeric, METH_NOARGS, unicode_isnumeric__doc__},
|
||||
|
|
@ -690,8 +692,8 @@ PyDoc_STRVAR(unicode_isidentifier__doc__,
|
|||
"\n"
|
||||
"Return True if the string is a valid Python identifier, False otherwise.\n"
|
||||
"\n"
|
||||
"Call keyword.iskeyword(s) to test whether string s is a reserved identifier,\n"
|
||||
"such as \"def\" or \"class\".");
|
||||
"Call keyword.iskeyword(s) to test whether string s is a reserved\n"
|
||||
"identifier, such as \"def\" or \"class\".");
|
||||
|
||||
#define UNICODE_ISIDENTIFIER_METHODDEF \
|
||||
{"isidentifier", (PyCFunction)unicode_isidentifier, METH_NOARGS, unicode_isidentifier__doc__},
|
||||
|
|
@ -731,8 +733,8 @@ PyDoc_STRVAR(unicode_join__doc__,
|
|||
"\n"
|
||||
"Concatenate any number of strings.\n"
|
||||
"\n"
|
||||
"The string whose method is called is inserted in between each given string.\n"
|
||||
"The result is returned as a new string.\n"
|
||||
"The string whose method is called is inserted in between each given\n"
|
||||
"string. The result is returned as a new string.\n"
|
||||
"\n"
|
||||
"Example: \'.\'.join([\'ab\', \'pq\', \'rs\']) -> \'ab.pq.rs\'");
|
||||
|
||||
|
|
@ -745,7 +747,8 @@ PyDoc_STRVAR(unicode_ljust__doc__,
|
|||
"\n"
|
||||
"Return a left-justified string of length width.\n"
|
||||
"\n"
|
||||
"Padding is done using the specified fill character (default is a space).");
|
||||
"Padding is done using the specified fill character (default is\n"
|
||||
"a space).");
|
||||
|
||||
#define UNICODE_LJUST_METHODDEF \
|
||||
{"ljust", _PyCFunction_CAST(unicode_ljust), METH_FASTCALL, unicode_ljust__doc__},
|
||||
|
|
@ -1008,8 +1011,9 @@ PyDoc_STRVAR(unicode_removeprefix__doc__,
|
|||
"\n"
|
||||
"Return a str with the given prefix string removed if present.\n"
|
||||
"\n"
|
||||
"If the string starts with the prefix string, return string[len(prefix):].\n"
|
||||
"Otherwise, return a copy of the original string.");
|
||||
"If the string starts with the prefix string, return\n"
|
||||
"string[len(prefix):]. Otherwise, return a copy of the original\n"
|
||||
"string.");
|
||||
|
||||
#define UNICODE_REMOVEPREFIX_METHODDEF \
|
||||
{"removeprefix", (PyCFunction)unicode_removeprefix, METH_O, unicode_removeprefix__doc__},
|
||||
|
|
@ -1040,9 +1044,9 @@ PyDoc_STRVAR(unicode_removesuffix__doc__,
|
|||
"\n"
|
||||
"Return a str with the given suffix string removed if present.\n"
|
||||
"\n"
|
||||
"If the string ends with the suffix string and that suffix is not empty,\n"
|
||||
"return string[:-len(suffix)]. Otherwise, return a copy of the original\n"
|
||||
"string.");
|
||||
"If the string ends with the suffix string and that suffix is not\n"
|
||||
"empty, return string[:-len(suffix)]. Otherwise, return a copy of\n"
|
||||
"the original string.");
|
||||
|
||||
#define UNICODE_REMOVESUFFIX_METHODDEF \
|
||||
{"removesuffix", (PyCFunction)unicode_removesuffix, METH_O, unicode_removesuffix__doc__},
|
||||
|
|
@ -1073,8 +1077,8 @@ PyDoc_STRVAR(unicode_rfind__doc__,
|
|||
"\n"
|
||||
"Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].\n"
|
||||
"\n"
|
||||
"Optional arguments start and end are interpreted as in slice notation.\n"
|
||||
"Return -1 on failure.");
|
||||
"Optional arguments start and end are interpreted as in slice\n"
|
||||
"notation. Return -1 on failure.");
|
||||
|
||||
#define UNICODE_RFIND_METHODDEF \
|
||||
{"rfind", _PyCFunction_CAST(unicode_rfind), METH_FASTCALL, unicode_rfind__doc__},
|
||||
|
|
@ -1129,8 +1133,8 @@ PyDoc_STRVAR(unicode_rindex__doc__,
|
|||
"\n"
|
||||
"Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].\n"
|
||||
"\n"
|
||||
"Optional arguments start and end are interpreted as in slice notation.\n"
|
||||
"Raises ValueError when the substring is not found.");
|
||||
"Optional arguments start and end are interpreted as in slice\n"
|
||||
"notation. Raises ValueError when the substring is not found.");
|
||||
|
||||
#define UNICODE_RINDEX_METHODDEF \
|
||||
{"rindex", _PyCFunction_CAST(unicode_rindex), METH_FASTCALL, unicode_rindex__doc__},
|
||||
|
|
@ -1185,7 +1189,8 @@ PyDoc_STRVAR(unicode_rjust__doc__,
|
|||
"\n"
|
||||
"Return a right-justified string of length width.\n"
|
||||
"\n"
|
||||
"Padding is done using the specified fill character (default is a space).");
|
||||
"Padding is done using the specified fill character (default is\n"
|
||||
"a space).");
|
||||
|
||||
#define UNICODE_RJUST_METHODDEF \
|
||||
{"rjust", _PyCFunction_CAST(unicode_rjust), METH_FASTCALL, unicode_rjust__doc__},
|
||||
|
|
@ -1237,18 +1242,18 @@ PyDoc_STRVAR(unicode_split__doc__,
|
|||
" sep\n"
|
||||
" The separator used to split the string.\n"
|
||||
"\n"
|
||||
" When set to None (the default value), will split on any whitespace\n"
|
||||
" character (including \\n \\r \\t \\f and spaces) and will discard\n"
|
||||
" empty strings from the result.\n"
|
||||
" When set to None (the default value), will split on any\n"
|
||||
" whitespace character (including \\n \\r \\t \\f and spaces) and\n"
|
||||
" will discard empty strings from the result.\n"
|
||||
" maxsplit\n"
|
||||
" Maximum number of splits.\n"
|
||||
" -1 (the default value) means no limit.\n"
|
||||
"\n"
|
||||
"Splitting starts at the front of the string and works to the end.\n"
|
||||
"\n"
|
||||
"Note, str.split() is mainly useful for data that has been intentionally\n"
|
||||
"delimited. With natural text that includes punctuation, consider using\n"
|
||||
"the regular expression module.");
|
||||
"Note, str.split() is mainly useful for data that has been\n"
|
||||
"intentionally delimited. With natural text that includes\n"
|
||||
"punctuation, consider using the regular expression module.");
|
||||
|
||||
#define UNICODE_SPLIT_METHODDEF \
|
||||
{"split", _PyCFunction_CAST(unicode_split), METH_FASTCALL|METH_KEYWORDS, unicode_split__doc__},
|
||||
|
|
@ -1331,12 +1336,12 @@ PyDoc_STRVAR(unicode_partition__doc__,
|
|||
"\n"
|
||||
"Partition the string into three parts using the given separator.\n"
|
||||
"\n"
|
||||
"This will search for the separator in the string. If the separator is found,\n"
|
||||
"returns a 3-tuple containing the part before the separator, the separator\n"
|
||||
"itself, and the part after it.\n"
|
||||
"This will search for the separator in the string. If the separator\n"
|
||||
"is found, returns a 3-tuple containing the part before the\n"
|
||||
"separator, the separator itself, and the part after it.\n"
|
||||
"\n"
|
||||
"If the separator is not found, returns a 3-tuple containing the original string\n"
|
||||
"and two empty strings.");
|
||||
"If the separator is not found, returns a 3-tuple containing\n"
|
||||
"the original string and two empty strings.");
|
||||
|
||||
#define UNICODE_PARTITION_METHODDEF \
|
||||
{"partition", (PyCFunction)unicode_partition, METH_O, unicode_partition__doc__},
|
||||
|
|
@ -1347,12 +1352,13 @@ PyDoc_STRVAR(unicode_rpartition__doc__,
|
|||
"\n"
|
||||
"Partition the string into three parts using the given separator.\n"
|
||||
"\n"
|
||||
"This will search for the separator in the string, starting at the end. If\n"
|
||||
"the separator is found, returns a 3-tuple containing the part before the\n"
|
||||
"separator, the separator itself, and the part after it.\n"
|
||||
"This will search for the separator in the string, starting at the\n"
|
||||
"end. If the separator is found, returns a 3-tuple containing the\n"
|
||||
"part before the separator, the separator itself, and the part after\n"
|
||||
"it.\n"
|
||||
"\n"
|
||||
"If the separator is not found, returns a 3-tuple containing two empty strings\n"
|
||||
"and the original string.");
|
||||
"If the separator is not found, returns a 3-tuple containing two\n"
|
||||
"empty strings and the original string.");
|
||||
|
||||
#define UNICODE_RPARTITION_METHODDEF \
|
||||
{"rpartition", (PyCFunction)unicode_rpartition, METH_O, unicode_rpartition__doc__},
|
||||
|
|
@ -1366,9 +1372,9 @@ PyDoc_STRVAR(unicode_rsplit__doc__,
|
|||
" sep\n"
|
||||
" The separator used to split the string.\n"
|
||||
"\n"
|
||||
" When set to None (the default value), will split on any whitespace\n"
|
||||
" character (including \\n \\r \\t \\f and spaces) and will discard\n"
|
||||
" empty strings from the result.\n"
|
||||
" When set to None (the default value), will split on any\n"
|
||||
" whitespace character (including \\n \\r \\t \\f and spaces) and\n"
|
||||
" will discard empty strings from the result.\n"
|
||||
" maxsplit\n"
|
||||
" Maximum number of splits.\n"
|
||||
" -1 (the default value) means no limit.\n"
|
||||
|
|
@ -1456,8 +1462,8 @@ PyDoc_STRVAR(unicode_splitlines__doc__,
|
|||
"\n"
|
||||
"Return a list of the lines in the string, breaking at line boundaries.\n"
|
||||
"\n"
|
||||
"Line breaks are not included in the resulting list unless keepends is given and\n"
|
||||
"true.");
|
||||
"Line breaks are not included in the resulting list unless keepends\n"
|
||||
"is given and true.");
|
||||
|
||||
#define UNICODE_SPLITLINES_METHODDEF \
|
||||
{"splitlines", _PyCFunction_CAST(unicode_splitlines), METH_FASTCALL|METH_KEYWORDS, unicode_splitlines__doc__},
|
||||
|
|
@ -1543,13 +1549,14 @@ PyDoc_STRVAR(unicode_maketrans__doc__,
|
|||
"\n"
|
||||
"Return a translation table usable for str.translate().\n"
|
||||
"\n"
|
||||
"If there is only one argument, it must be a dictionary mapping Unicode\n"
|
||||
"ordinals (integers) or characters to Unicode ordinals, strings or None.\n"
|
||||
"Character keys will be then converted to ordinals.\n"
|
||||
"If there are two arguments, they must be strings of equal length, and\n"
|
||||
"in the resulting dictionary, each character in x will be mapped to the\n"
|
||||
"character at the same position in y. If there is a third argument, it\n"
|
||||
"must be a string, whose characters will be mapped to None in the result.");
|
||||
"If there is only one argument, it must be a dictionary mapping\n"
|
||||
"Unicode ordinals (integers) or characters to Unicode ordinals,\n"
|
||||
"strings or None. Character keys will be then converted to ordinals.\n"
|
||||
"If there are two arguments, they must be strings of equal length,\n"
|
||||
"and in the resulting dictionary, each character in x will be mapped\n"
|
||||
"to the character at the same position in y. If there is a third\n"
|
||||
"argument, it must be a string, whose characters will be mapped to\n"
|
||||
"None in the result.");
|
||||
|
||||
#define UNICODE_MAKETRANS_METHODDEF \
|
||||
{"maketrans", _PyCFunction_CAST(unicode_maketrans), METH_FASTCALL|METH_STATIC, unicode_maketrans__doc__},
|
||||
|
|
@ -1599,12 +1606,13 @@ PyDoc_STRVAR(unicode_translate__doc__,
|
|||
"Replace each character in the string using the given translation table.\n"
|
||||
"\n"
|
||||
" table\n"
|
||||
" Translation table, which must be a mapping of Unicode ordinals to\n"
|
||||
" Unicode ordinals, strings, or None.\n"
|
||||
" Translation table, which must be a mapping of Unicode ordinals\n"
|
||||
" to Unicode ordinals, strings, or None.\n"
|
||||
"\n"
|
||||
"The table must implement lookup/indexing via __getitem__, for instance a\n"
|
||||
"dictionary or list. If this operation raises LookupError, the character is\n"
|
||||
"left untouched. Characters mapped to None are deleted.");
|
||||
"The table must implement lookup/indexing via __getitem__, for\n"
|
||||
"instance a dictionary or list. If this operation raises\n"
|
||||
"LookupError, the character is left untouched. Characters mapped to\n"
|
||||
"None are deleted.");
|
||||
|
||||
#define UNICODE_TRANSLATE_METHODDEF \
|
||||
{"translate", (PyCFunction)unicode_translate, METH_O, unicode_translate__doc__},
|
||||
|
|
@ -1908,4 +1916,4 @@ skip_optional_pos:
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=13eaf65699ea9fc9 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=9d243c63e951e31d input=a9049054013a1b77]*/
|
||||
|
|
|
|||
|
|
@ -2840,12 +2840,13 @@ code._varname_from_oparg
|
|||
|
||||
(internal-only) Return the local variable name for the given oparg.
|
||||
|
||||
WARNING: this method is for internal use only and may change or go away.
|
||||
WARNING: this method is for internal use only and may change or go
|
||||
away.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
code__varname_from_oparg_impl(PyCodeObject *self, int oparg)
|
||||
/*[clinic end generated code: output=1fd1130413184206 input=c5fa3ee9bac7d4ca]*/
|
||||
/*[clinic end generated code: output=1fd1130413184206 input=6ba7d6df0d566463]*/
|
||||
{
|
||||
PyObject *name = PyTuple_GetItem(self->co_localsplusnames, oparg);
|
||||
if (name == NULL) {
|
||||
|
|
|
|||
|
|
@ -3892,6 +3892,7 @@ PyDict_Items(PyObject *dict)
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_summary
|
||||
@classmethod
|
||||
dict.fromkeys
|
||||
iterable: object
|
||||
|
|
@ -3903,7 +3904,7 @@ Create a new dictionary with keys from iterable and values set to value.
|
|||
|
||||
static PyObject *
|
||||
dict_fromkeys_impl(PyTypeObject *type, PyObject *iterable, PyObject *value)
|
||||
/*[clinic end generated code: output=8fb98e4b10384999 input=382ba4855d0f74c3]*/
|
||||
/*[clinic end generated code: output=8fb98e4b10384999 input=3903715eb48b287e]*/
|
||||
{
|
||||
return _PyDict_FromKeys((PyObject *)type, iterable, value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1670,7 +1670,6 @@ float___getnewargs___impl(PyObject *self)
|
|||
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_docstring_body
|
||||
@classmethod
|
||||
float.__getformat__
|
||||
|
||||
|
|
@ -1683,13 +1682,13 @@ You probably don't want to use this function.
|
|||
It exists mainly to be used in Python's test suite.
|
||||
|
||||
This function returns whichever of 'IEEE, big-endian' or 'IEEE,
|
||||
little-endian' best describes the format of floating-point numbers used by the
|
||||
C type named by typestr.
|
||||
little-endian' best describes the format of floating-point numbers
|
||||
used by the C type named by typestr.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
float___getformat___impl(PyTypeObject *type, const char *typestr)
|
||||
/*[clinic end generated code: output=2bfb987228cc9628 input=0ae1ba35d192f704]*/
|
||||
/*[clinic end generated code: output=2bfb987228cc9628 input=eb1cf45e9bddab72]*/
|
||||
{
|
||||
if (strcmp(typestr, "double") != 0 && strcmp(typestr, "float") != 0) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
|
|
|
|||
|
|
@ -1890,6 +1890,7 @@ frame_trace_set_impl(PyFrameObject *self, PyObject *value)
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_summary
|
||||
@critical_section
|
||||
@getter
|
||||
frame.f_generator as frame_generator
|
||||
|
|
@ -1899,7 +1900,7 @@ Return the generator or coroutine associated with this frame, or None.
|
|||
|
||||
static PyObject *
|
||||
frame_generator_get_impl(PyFrameObject *self)
|
||||
/*[clinic end generated code: output=97aeb2392562e55b input=00a2bd008b239ab0]*/
|
||||
/*[clinic end generated code: output=97aeb2392562e55b input=3ffba57ba10f84be]*/
|
||||
{
|
||||
if (self->f_frame->owner == FRAME_OWNED_BY_GENERATOR) {
|
||||
PyObject *gen = (PyObject *)_PyGen_GetGeneratorFromFrame(self->f_frame);
|
||||
|
|
|
|||
|
|
@ -2922,7 +2922,6 @@ unsafe_tuple_compare(PyObject *v, PyObject *w, MergeState *ms)
|
|||
* duplicated).
|
||||
*/
|
||||
/*[clinic input]
|
||||
@permit_long_docstring_body
|
||||
@critical_section
|
||||
list.sort
|
||||
|
||||
|
|
@ -2932,18 +2931,18 @@ list.sort
|
|||
|
||||
Sort the list in ascending order and return None.
|
||||
|
||||
The sort is in-place (i.e. the list itself is modified) and stable (i.e. the
|
||||
order of two equal elements is maintained).
|
||||
The sort is in-place (i.e. the list itself is modified) and stable
|
||||
(i.e. the order of two equal elements is maintained).
|
||||
|
||||
If a key function is given, apply it once to each list item and sort them,
|
||||
ascending or descending, according to their function values.
|
||||
If a key function is given, apply it once to each list item and sort
|
||||
them, ascending or descending, according to their function values.
|
||||
|
||||
The reverse flag can be set to sort in descending order.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
list_sort_impl(PyListObject *self, PyObject *keyfunc, int reverse)
|
||||
/*[clinic end generated code: output=57b9f9c5e23fbe42 input=e4f6b6069181ad7d]*/
|
||||
/*[clinic end generated code: output=57b9f9c5e23fbe42 input=c145526281e1fb9f]*/
|
||||
{
|
||||
MergeState ms;
|
||||
Py_ssize_t nremaining;
|
||||
|
|
|
|||
|
|
@ -6367,20 +6367,21 @@ int_as_integer_ratio_impl(PyObject *self)
|
|||
int.to_bytes
|
||||
|
||||
length: Py_ssize_t(allow_negative=False) = 1
|
||||
Length of bytes object to use. An OverflowError is raised if the
|
||||
integer is not representable with the given number of bytes. Default
|
||||
is length 1.
|
||||
Length of bytes object to use. An OverflowError is raised if
|
||||
the integer is not representable with the given number of bytes.
|
||||
Default is length 1.
|
||||
byteorder: unicode(c_default="NULL") = "big"
|
||||
The byte order used to represent the integer. If byteorder is 'big',
|
||||
the most significant byte is at the beginning of the byte array. If
|
||||
byteorder is 'little', the most significant byte is at the end of the
|
||||
byte array. To request the native byte order of the host system, use
|
||||
sys.byteorder as the byte order value. Default is to use 'big'.
|
||||
The byte order used to represent the integer. If byteorder is
|
||||
'big', the most significant byte is at the beginning of the byte
|
||||
array. If byteorder is 'little', the most significant byte is at
|
||||
the end of the byte array. To request the native byte order of
|
||||
the host system, use sys.byteorder as the byte order value.
|
||||
Default is to use 'big'.
|
||||
*
|
||||
signed as is_signed: bool = False
|
||||
Determines whether two's complement is used to represent the integer.
|
||||
If signed is False and a negative integer is given, an OverflowError
|
||||
is raised.
|
||||
Determines whether two's complement is used to represent the
|
||||
integer. If signed is False and a negative integer is given,
|
||||
an OverflowError is raised.
|
||||
|
||||
Return an array of bytes representing an integer.
|
||||
[clinic start generated code]*/
|
||||
|
|
@ -6388,7 +6389,7 @@ Return an array of bytes representing an integer.
|
|||
static PyObject *
|
||||
int_to_bytes_impl(PyObject *self, Py_ssize_t length, PyObject *byteorder,
|
||||
int is_signed)
|
||||
/*[clinic end generated code: output=89c801df114050a3 input=66f9d0c20529b44f]*/
|
||||
/*[clinic end generated code: output=89c801df114050a3 input=c74a93c07b2f6526]*/
|
||||
{
|
||||
int little_endian;
|
||||
if (byteorder == NULL)
|
||||
|
|
@ -6424,18 +6425,20 @@ int.from_bytes
|
|||
|
||||
bytes as bytes_obj: object
|
||||
Holds the array of bytes to convert. The argument must either
|
||||
support the buffer protocol or be an iterable object producing bytes.
|
||||
Bytes and bytearray are examples of built-in objects that support the
|
||||
buffer protocol.
|
||||
support the buffer protocol or be an iterable object producing
|
||||
bytes. Bytes and bytearray are examples of built-in objects that
|
||||
support the buffer protocol.
|
||||
byteorder: unicode(c_default="NULL") = "big"
|
||||
The byte order used to represent the integer. If byteorder is 'big',
|
||||
the most significant byte is at the beginning of the byte array. If
|
||||
byteorder is 'little', the most significant byte is at the end of the
|
||||
byte array. To request the native byte order of the host system, use
|
||||
sys.byteorder as the byte order value. Default is to use 'big'.
|
||||
The byte order used to represent the integer. If byteorder is
|
||||
'big', the most significant byte is at the beginning of the byte
|
||||
array. If byteorder is 'little', the most significant byte is at
|
||||
the end of the byte array. To request the native byte order of
|
||||
the host system, use sys.byteorder as the byte order value.
|
||||
Default is to use 'big'.
|
||||
*
|
||||
signed as is_signed: bool = False
|
||||
Indicates whether two's complement is used to represent the integer.
|
||||
Indicates whether two's complement is used to represent the
|
||||
integer.
|
||||
|
||||
Return the integer represented by the given array of bytes.
|
||||
[clinic start generated code]*/
|
||||
|
|
@ -6443,7 +6446,7 @@ Return the integer represented by the given array of bytes.
|
|||
static PyObject *
|
||||
int_from_bytes_impl(PyTypeObject *type, PyObject *bytes_obj,
|
||||
PyObject *byteorder, int is_signed)
|
||||
/*[clinic end generated code: output=efc5d68e31f9314f input=2ff527997fe7b0c5]*/
|
||||
/*[clinic end generated code: output=efc5d68e31f9314f input=95801e50b942e164]*/
|
||||
{
|
||||
int little_endian;
|
||||
PyObject *long_obj, *bytes;
|
||||
|
|
@ -6508,6 +6511,7 @@ long_long_getter(PyObject *self, void *Py_UNUSED(ignored))
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_summary
|
||||
int.is_integer
|
||||
|
||||
Returns True. Exists for duck type compatibility with float.is_integer.
|
||||
|
|
@ -6515,7 +6519,7 @@ Returns True. Exists for duck type compatibility with float.is_integer.
|
|||
|
||||
static PyObject *
|
||||
int_is_integer_impl(PyObject *self)
|
||||
/*[clinic end generated code: output=90f8e794ce5430ef input=7e41c4d4416e05f2]*/
|
||||
/*[clinic end generated code: output=90f8e794ce5430ef input=aacf01a2c81c0244]*/
|
||||
{
|
||||
Py_RETURN_TRUE;
|
||||
}
|
||||
|
|
@ -6597,7 +6601,8 @@ If x is not a number or if base is given, then x must be a string,\n\
|
|||
bytes, or bytearray instance representing an integer literal in the\n\
|
||||
given base. The literal can be preceded by '+' or '-' and be surrounded\n\
|
||||
by whitespace. The base defaults to 10. Valid bases are 0 and 2-36.\n\
|
||||
Base 0 means to interpret the base from the string as an integer literal.\n\
|
||||
Base 0 means to interpret the base from the string as an integer\n\
|
||||
iteral.\n\
|
||||
>>> int('0b100', base=0)\n\
|
||||
4");
|
||||
|
||||
|
|
|
|||
|
|
@ -2339,23 +2339,23 @@ memoryview_tolist_impl(PyMemoryViewObject *self)
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_docstring_body
|
||||
memoryview.tobytes
|
||||
|
||||
order: str(accept={str, NoneType}, c_default="NULL") = 'C'
|
||||
|
||||
Return the data in the buffer as a byte string.
|
||||
|
||||
Order can be {'C', 'F', 'A'}. When order is 'C' or 'F', the data of the
|
||||
original array is converted to C or Fortran order. For contiguous views,
|
||||
'A' returns an exact copy of the physical memory. In particular, in-memory
|
||||
Fortran order is preserved. For non-contiguous views, the data is converted
|
||||
to C first. order=None is the same as order='C'.
|
||||
Order can be {'C', 'F', 'A'}. When order is 'C' or 'F', the data of
|
||||
the original array is converted to C or Fortran order. For
|
||||
contiguous views, 'A' returns an exact copy of the physical memory.
|
||||
In particular, in-memory Fortran order is preserved. For
|
||||
non-contiguous views, the data is converted to C first. order=None
|
||||
is the same as order='C'.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
memoryview_tobytes_impl(PyMemoryViewObject *self, const char *order)
|
||||
/*[clinic end generated code: output=1288b62560a32a23 input=23c9faf372cfdbcc]*/
|
||||
/*[clinic end generated code: output=1288b62560a32a23 input=119c70aa91791dc8]*/
|
||||
{
|
||||
Py_buffer *src = VIEW_ADDR(self);
|
||||
char ord = 'C';
|
||||
|
|
@ -2396,8 +2396,8 @@ memoryview.hex
|
|||
sep: object = NULL
|
||||
An optional single character or byte to separate hex bytes.
|
||||
bytes_per_sep: Py_ssize_t = 1
|
||||
How many bytes between separators. Positive values count from the
|
||||
right, negative values count from the left.
|
||||
How many bytes between separators. Positive values count from
|
||||
the right, negative values count from the left.
|
||||
|
||||
Return the data in the buffer as a str of hexadecimal numbers.
|
||||
|
||||
|
|
@ -2416,7 +2416,7 @@ Return the data in the buffer as a str of hexadecimal numbers.
|
|||
static PyObject *
|
||||
memoryview_hex_impl(PyMemoryViewObject *self, PyObject *sep,
|
||||
Py_ssize_t bytes_per_sep)
|
||||
/*[clinic end generated code: output=c9bb00c7a8e86056 input=dc48a56ed3b058ae]*/
|
||||
/*[clinic end generated code: output=c9bb00c7a8e86056 input=3f1c5d08906e3b70]*/
|
||||
{
|
||||
Py_buffer *src = VIEW_ADDR(self);
|
||||
|
||||
|
|
|
|||
|
|
@ -1149,12 +1149,13 @@ OrderedDict.popitem
|
|||
|
||||
Remove and return a (key, value) pair from the dictionary.
|
||||
|
||||
Pairs are returned in LIFO order if last is true or FIFO order if false.
|
||||
Pairs are returned in LIFO order if last is true or FIFO order if
|
||||
false.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
OrderedDict_popitem_impl(PyODictObject *self, int last)
|
||||
/*[clinic end generated code: output=98e7d986690d49eb input=8aafc7433e0a40e7]*/
|
||||
/*[clinic end generated code: output=98e7d986690d49eb input=ebf1cc91579c9e54]*/
|
||||
{
|
||||
PyObject *key, *value;
|
||||
_ODictNode *node;
|
||||
|
|
|
|||
|
|
@ -2121,6 +2121,7 @@ set_difference(PySetObject *so, PyObject *other)
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_summary
|
||||
set.difference as set_difference_multi
|
||||
so: setobject
|
||||
*others: array
|
||||
|
|
@ -2131,7 +2132,7 @@ Return a new set with elements in the set that are not in the others.
|
|||
static PyObject *
|
||||
set_difference_multi_impl(PySetObject *so, PyObject * const *others,
|
||||
Py_ssize_t others_length)
|
||||
/*[clinic end generated code: output=b0d33fb05d5477a7 input=c1eb448d483416ad]*/
|
||||
/*[clinic end generated code: output=b0d33fb05d5477a7 input=e0fbedbf79d91d4e]*/
|
||||
{
|
||||
Py_ssize_t i;
|
||||
PyObject *result, *other;
|
||||
|
|
@ -2303,6 +2304,7 @@ set_symmetric_difference_update_impl(PySetObject *so, PyObject *other)
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_summary
|
||||
@critical_section so other
|
||||
set.symmetric_difference
|
||||
so: setobject
|
||||
|
|
@ -2314,7 +2316,7 @@ Return a new set with elements in either the set or other but not both.
|
|||
|
||||
static PyObject *
|
||||
set_symmetric_difference_impl(PySetObject *so, PyObject *other)
|
||||
/*[clinic end generated code: output=270ee0b5d42b0797 input=624f6e7bbdf70db1]*/
|
||||
/*[clinic end generated code: output=270ee0b5d42b0797 input=8c29b0be90d47feb]*/
|
||||
{
|
||||
PySetObject *result = (PySetObject *)make_new_set_basetype(Py_TYPE(so), NULL);
|
||||
if (result == NULL) {
|
||||
|
|
|
|||
|
|
@ -334,7 +334,9 @@ PyDoc_STRVAR(slice_doc,
|
|||
"slice(stop)\n\
|
||||
slice(start, stop[, step])\n\
|
||||
\n\
|
||||
Create a slice object. This is used for extended slicing (e.g. a[0:10:2]).");
|
||||
Create a slice object.\n\
|
||||
\n\
|
||||
This is used for extended slicing (e.g. a[0:10:2]).");
|
||||
|
||||
static void
|
||||
slice_dealloc(PyObject *op)
|
||||
|
|
|
|||
|
|
@ -12941,7 +12941,8 @@ PyDoc_STRVAR(super_doc,
|
|||
"super() -> same as super(__class__, <first argument>)\n"
|
||||
"super(type) -> unbound super object\n"
|
||||
"super(type, obj) -> bound super object; requires isinstance(obj, type)\n"
|
||||
"super(type, type2) -> bound super object; requires issubclass(type2, type)\n"
|
||||
"super(type, type2) -> bound super object; requires\n"
|
||||
" issubclass(type2, type)\n"
|
||||
"Typical use to call a cooperative superclass method:\n"
|
||||
"class C(B):\n"
|
||||
" def meth(self, arg):\n"
|
||||
|
|
|
|||
|
|
@ -10794,35 +10794,33 @@ replace(PyObject *self, PyObject *str1,
|
|||
/* --- Unicode Object Methods --------------------------------------------- */
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_docstring_body
|
||||
str.title as unicode_title
|
||||
|
||||
Return a version of the string where each word is titlecased.
|
||||
|
||||
More specifically, words start with uppercased characters and all remaining
|
||||
cased characters have lower case.
|
||||
More specifically, words start with uppercased characters and all
|
||||
remaining cased characters have lower case.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
unicode_title_impl(PyObject *self)
|
||||
/*[clinic end generated code: output=c75ae03809574902 input=533ce0eb6a7f5d1b]*/
|
||||
/*[clinic end generated code: output=c75ae03809574902 input=2a07e2c7df94627a]*/
|
||||
{
|
||||
return case_operation(self, do_title);
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_docstring_body
|
||||
str.capitalize as unicode_capitalize
|
||||
|
||||
Return a capitalized version of the string.
|
||||
|
||||
More specifically, make the first character have upper case and the rest lower
|
||||
case.
|
||||
More specifically, make the first character have upper case and the
|
||||
rest lower case.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
unicode_capitalize_impl(PyObject *self)
|
||||
/*[clinic end generated code: output=e49a4c333cdb7667 input=a4a15ade41f6f9e9]*/
|
||||
/*[clinic end generated code: output=e49a4c333cdb7667 input=e50e50ed45a654cf]*/
|
||||
{
|
||||
if (PyUnicode_GET_LENGTH(self) == 0)
|
||||
return unicode_result_unchanged(self);
|
||||
|
|
@ -10876,12 +10874,13 @@ str.center as unicode_center
|
|||
|
||||
Return a centered string of length width.
|
||||
|
||||
Padding is done using the specified fill character (default is a space).
|
||||
Padding is done using the specified fill character (default is
|
||||
a space).
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
unicode_center_impl(PyObject *self, Py_ssize_t width, Py_UCS4 fillchar)
|
||||
/*[clinic end generated code: output=420c8859effc7c0c input=b42b247eb26e6519]*/
|
||||
/*[clinic end generated code: output=420c8859effc7c0c input=df91017dfd186a78]*/
|
||||
{
|
||||
Py_ssize_t marg, left;
|
||||
|
||||
|
|
@ -11441,13 +11440,14 @@ str.count as unicode_count -> Py_ssize_t
|
|||
|
||||
Return the number of non-overlapping occurrences of substring sub in string S[start:end].
|
||||
|
||||
Optional arguments start and end are interpreted as in slice notation.
|
||||
Optional arguments start and end are interpreted as in slice
|
||||
notation.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static Py_ssize_t
|
||||
unicode_count_impl(PyObject *str, PyObject *substr, Py_ssize_t start,
|
||||
Py_ssize_t end)
|
||||
/*[clinic end generated code: output=8fcc3aef0b18edbf input=8590716ee228b935]*/
|
||||
/*[clinic end generated code: output=8fcc3aef0b18edbf input=c9209e05438cc352]*/
|
||||
{
|
||||
assert(PyUnicode_Check(str));
|
||||
assert(PyUnicode_Check(substr));
|
||||
|
|
@ -11520,8 +11520,8 @@ str.encode as unicode_encode
|
|||
errors: str(c_default="NULL") = 'strict'
|
||||
The error handling scheme to use for encoding errors.
|
||||
The default is 'strict' meaning that encoding errors raise a
|
||||
UnicodeEncodeError. Other possible values are 'ignore', 'replace' and
|
||||
'xmlcharrefreplace' as well as any other name registered with
|
||||
UnicodeEncodeError. Other possible values are 'ignore', 'replace'
|
||||
and 'xmlcharrefreplace' as well as any other name registered with
|
||||
codecs.register_error that can handle UnicodeEncodeErrors.
|
||||
|
||||
Encode the string using the codec registered for encoding.
|
||||
|
|
@ -11529,7 +11529,7 @@ Encode the string using the codec registered for encoding.
|
|||
|
||||
static PyObject *
|
||||
unicode_encode_impl(PyObject *self, const char *encoding, const char *errors)
|
||||
/*[clinic end generated code: output=bf78b6e2a9470e3c input=f0a9eb293d08fe02]*/
|
||||
/*[clinic end generated code: output=bf78b6e2a9470e3c input=b85a9645cb33b729]*/
|
||||
{
|
||||
return PyUnicode_AsEncodedString(self, encoding, errors);
|
||||
}
|
||||
|
|
@ -11626,14 +11626,14 @@ str.find as unicode_find = str.count
|
|||
|
||||
Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].
|
||||
|
||||
Optional arguments start and end are interpreted as in slice notation.
|
||||
Return -1 on failure.
|
||||
Optional arguments start and end are interpreted as in slice
|
||||
notation. Return -1 on failure.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static Py_ssize_t
|
||||
unicode_find_impl(PyObject *str, PyObject *substr, Py_ssize_t start,
|
||||
Py_ssize_t end)
|
||||
/*[clinic end generated code: output=51dbe6255712e278 input=3a9d650fe4c24695]*/
|
||||
/*[clinic end generated code: output=51dbe6255712e278 input=f57e93c59d1ee927]*/
|
||||
{
|
||||
Py_ssize_t result = any_find_slice(str, substr, start, end, 1);
|
||||
if (result < 0) {
|
||||
|
|
@ -11690,14 +11690,14 @@ str.index as unicode_index = str.count
|
|||
|
||||
Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].
|
||||
|
||||
Optional arguments start and end are interpreted as in slice notation.
|
||||
Raises ValueError when the substring is not found.
|
||||
Optional arguments start and end are interpreted as in slice
|
||||
notation. Raises ValueError when the substring is not found.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static Py_ssize_t
|
||||
unicode_index_impl(PyObject *str, PyObject *substr, Py_ssize_t start,
|
||||
Py_ssize_t end)
|
||||
/*[clinic end generated code: output=77558288837cdf40 input=ae5e48f69ed75b06]*/
|
||||
/*[clinic end generated code: output=77558288837cdf40 input=5900ab84de55e628]*/
|
||||
{
|
||||
Py_ssize_t result = any_find_slice(str, substr, start, end, 1);
|
||||
if (result == -1) {
|
||||
|
|
@ -11710,6 +11710,7 @@ unicode_index_impl(PyObject *str, PyObject *substr, Py_ssize_t start,
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_summary
|
||||
str.isascii as unicode_isascii
|
||||
|
||||
Return True if all characters in the string are ASCII, False otherwise.
|
||||
|
|
@ -11720,24 +11721,23 @@ Empty string is ASCII too.
|
|||
|
||||
static PyObject *
|
||||
unicode_isascii_impl(PyObject *self)
|
||||
/*[clinic end generated code: output=c5910d64b5a8003f input=5a43cbc6399621d5]*/
|
||||
/*[clinic end generated code: output=c5910d64b5a8003f input=dc74e1ced821159f]*/
|
||||
{
|
||||
return PyBool_FromLong(PyUnicode_IS_ASCII(self));
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_docstring_body
|
||||
str.islower as unicode_islower
|
||||
|
||||
Return True if the string is a lowercase string, False otherwise.
|
||||
|
||||
A string is lowercase if all cased characters in the string are lowercase and
|
||||
there is at least one cased character in the string.
|
||||
A string is lowercase if all cased characters in the string are
|
||||
lowercase and there is at least one cased character in the string.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
unicode_islower_impl(PyObject *self)
|
||||
/*[clinic end generated code: output=dbd41995bd005b81 input=c6fc0295241a1aaa]*/
|
||||
/*[clinic end generated code: output=dbd41995bd005b81 input=1879b48dfc628366]*/
|
||||
{
|
||||
Py_ssize_t i, length;
|
||||
int kind;
|
||||
|
|
@ -11770,18 +11770,17 @@ unicode_islower_impl(PyObject *self)
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_docstring_body
|
||||
str.isupper as unicode_isupper
|
||||
|
||||
Return True if the string is an uppercase string, False otherwise.
|
||||
|
||||
A string is uppercase if all cased characters in the string are uppercase and
|
||||
there is at least one cased character in the string.
|
||||
A string is uppercase if all cased characters in the string are
|
||||
uppercase and there is at least one cased character in the string.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
unicode_isupper_impl(PyObject *self)
|
||||
/*[clinic end generated code: output=049209c8e7f15f59 input=8d5cb33e67efde72]*/
|
||||
/*[clinic end generated code: output=049209c8e7f15f59 input=77d29904aef0e3a0]*/
|
||||
{
|
||||
Py_ssize_t i, length;
|
||||
int kind;
|
||||
|
|
@ -11870,18 +11869,17 @@ unicode_istitle_impl(PyObject *self)
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_docstring_body
|
||||
str.isspace as unicode_isspace
|
||||
|
||||
Return True if the string is a whitespace string, False otherwise.
|
||||
|
||||
A string is whitespace if all characters in the string are whitespace and there
|
||||
is at least one character in the string.
|
||||
A string is whitespace if all characters in the string are
|
||||
whitespace and there is at least one character in the string.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
unicode_isspace_impl(PyObject *self)
|
||||
/*[clinic end generated code: output=163a63bfa08ac2b9 input=44fe05e248c6e159]*/
|
||||
/*[clinic end generated code: output=163a63bfa08ac2b9 input=29e09560fc23fbeb]*/
|
||||
{
|
||||
Py_ssize_t i, length;
|
||||
int kind;
|
||||
|
|
@ -11909,18 +11907,17 @@ unicode_isspace_impl(PyObject *self)
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_docstring_body
|
||||
str.isalpha as unicode_isalpha
|
||||
|
||||
Return True if the string is an alphabetic string, False otherwise.
|
||||
|
||||
A string is alphabetic if all characters in the string are alphabetic and there
|
||||
is at least one character in the string.
|
||||
A string is alphabetic if all characters in the string are
|
||||
alphabetic and there is at least one character in the string.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
unicode_isalpha_impl(PyObject *self)
|
||||
/*[clinic end generated code: output=cc81b9ac3883ec4f input=c233000624a56e0d]*/
|
||||
/*[clinic end generated code: output=cc81b9ac3883ec4f input=9906a07f3e04892e]*/
|
||||
{
|
||||
Py_ssize_t i, length;
|
||||
int kind;
|
||||
|
|
@ -11947,18 +11944,18 @@ unicode_isalpha_impl(PyObject *self)
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_docstring_body
|
||||
@permit_long_summary
|
||||
str.isalnum as unicode_isalnum
|
||||
|
||||
Return True if the string is an alpha-numeric string, False otherwise.
|
||||
|
||||
A string is alpha-numeric if all characters in the string are alpha-numeric and
|
||||
there is at least one character in the string.
|
||||
A string is alpha-numeric if all characters in the string are
|
||||
alpha-numeric and there is at least one character in the string.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
unicode_isalnum_impl(PyObject *self)
|
||||
/*[clinic end generated code: output=a5a23490ffc3660c input=5d63ba9c9bafdb6b]*/
|
||||
/*[clinic end generated code: output=a5a23490ffc3660c input=892f64ebc171fd4f]*/
|
||||
{
|
||||
int kind;
|
||||
const void *data;
|
||||
|
|
@ -11987,18 +11984,17 @@ unicode_isalnum_impl(PyObject *self)
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_docstring_body
|
||||
str.isdecimal as unicode_isdecimal
|
||||
|
||||
Return True if the string is a decimal string, False otherwise.
|
||||
|
||||
A string is a decimal string if all characters in the string are decimal and
|
||||
there is at least one character in the string.
|
||||
A string is a decimal string if all characters in the string are
|
||||
decimal and there is at least one character in the string.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
unicode_isdecimal_impl(PyObject *self)
|
||||
/*[clinic end generated code: output=fb2dcdb62d3fc548 input=8e84a58b414935a3]*/
|
||||
/*[clinic end generated code: output=fb2dcdb62d3fc548 input=63b0453c48cad0af]*/
|
||||
{
|
||||
Py_ssize_t i, length;
|
||||
int kind;
|
||||
|
|
@ -12025,18 +12021,17 @@ unicode_isdecimal_impl(PyObject *self)
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_docstring_body
|
||||
str.isdigit as unicode_isdigit
|
||||
|
||||
Return True if the string is a digit string, False otherwise.
|
||||
|
||||
A string is a digit string if all characters in the string are digits and there
|
||||
is at least one character in the string.
|
||||
A string is a digit string if all characters in the string are
|
||||
digits and there is at least one character in the string.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
unicode_isdigit_impl(PyObject *self)
|
||||
/*[clinic end generated code: output=10a6985311da6858 input=99e284affb54d4a0]*/
|
||||
/*[clinic end generated code: output=10a6985311da6858 input=353b03747b062e4b]*/
|
||||
{
|
||||
Py_ssize_t i, length;
|
||||
int kind;
|
||||
|
|
@ -12064,18 +12059,17 @@ unicode_isdigit_impl(PyObject *self)
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_docstring_body
|
||||
str.isnumeric as unicode_isnumeric
|
||||
|
||||
Return True if the string is a numeric string, False otherwise.
|
||||
|
||||
A string is numeric if all characters in the string are numeric and there is at
|
||||
least one character in the string.
|
||||
A string is numeric if all characters in the string are numeric and
|
||||
there is at least one character in the string.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
unicode_isnumeric_impl(PyObject *self)
|
||||
/*[clinic end generated code: output=9172a32d9013051a input=e9f5b6b8b29b0ee6]*/
|
||||
/*[clinic end generated code: output=9172a32d9013051a input=83b2a072ed7aff48]*/
|
||||
{
|
||||
Py_ssize_t i, length;
|
||||
int kind;
|
||||
|
|
@ -12145,18 +12139,18 @@ PyUnicode_IsIdentifier(PyObject *self)
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_docstring_body
|
||||
@permit_long_summary
|
||||
str.isidentifier as unicode_isidentifier
|
||||
|
||||
Return True if the string is a valid Python identifier, False otherwise.
|
||||
|
||||
Call keyword.iskeyword(s) to test whether string s is a reserved identifier,
|
||||
such as "def" or "class".
|
||||
Call keyword.iskeyword(s) to test whether string s is a reserved
|
||||
identifier, such as "def" or "class".
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
unicode_isidentifier_impl(PyObject *self)
|
||||
/*[clinic end generated code: output=fe585a9666572905 input=86315dd889d7bd04]*/
|
||||
/*[clinic end generated code: output=fe585a9666572905 input=cabde62c20a3be6b]*/
|
||||
{
|
||||
return PyBool_FromLong(PyUnicode_IsIdentifier(self));
|
||||
}
|
||||
|
|
@ -12196,7 +12190,6 @@ unicode_isprintable_impl(PyObject *self)
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_docstring_body
|
||||
str.join as unicode_join
|
||||
|
||||
iterable: object
|
||||
|
|
@ -12204,15 +12197,15 @@ str.join as unicode_join
|
|||
|
||||
Concatenate any number of strings.
|
||||
|
||||
The string whose method is called is inserted in between each given string.
|
||||
The result is returned as a new string.
|
||||
The string whose method is called is inserted in between each given
|
||||
string. The result is returned as a new string.
|
||||
|
||||
Example: '.'.join(['ab', 'pq', 'rs']) -> 'ab.pq.rs'
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
unicode_join(PyObject *self, PyObject *iterable)
|
||||
/*[clinic end generated code: output=6857e7cecfe7bf98 input=bac724ed412ef3f8]*/
|
||||
/*[clinic end generated code: output=6857e7cecfe7bf98 input=fd330a11ee845fb2]*/
|
||||
{
|
||||
return PyUnicode_Join(self, iterable);
|
||||
}
|
||||
|
|
@ -12232,12 +12225,13 @@ str.ljust as unicode_ljust
|
|||
|
||||
Return a left-justified string of length width.
|
||||
|
||||
Padding is done using the specified fill character (default is a space).
|
||||
Padding is done using the specified fill character (default is
|
||||
a space).
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
unicode_ljust_impl(PyObject *self, Py_ssize_t width, Py_UCS4 fillchar)
|
||||
/*[clinic end generated code: output=1cce0e0e0a0b84b3 input=3ab599e335e60a32]*/
|
||||
/*[clinic end generated code: output=1cce0e0e0a0b84b3 input=8a55f06694c20ed6]*/
|
||||
{
|
||||
if (PyUnicode_GET_LENGTH(self) >= width)
|
||||
return unicode_result_unchanged(self);
|
||||
|
|
@ -12593,7 +12587,6 @@ unicode_replace_impl(PyObject *self, PyObject *old, PyObject *new,
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_docstring_body
|
||||
str.removeprefix as unicode_removeprefix
|
||||
|
||||
prefix: unicode
|
||||
|
|
@ -12601,13 +12594,14 @@ str.removeprefix as unicode_removeprefix
|
|||
|
||||
Return a str with the given prefix string removed if present.
|
||||
|
||||
If the string starts with the prefix string, return string[len(prefix):].
|
||||
Otherwise, return a copy of the original string.
|
||||
If the string starts with the prefix string, return
|
||||
string[len(prefix):]. Otherwise, return a copy of the original
|
||||
string.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
unicode_removeprefix_impl(PyObject *self, PyObject *prefix)
|
||||
/*[clinic end generated code: output=f1e5945e9763bcb9 input=1989a856dbb813f1]*/
|
||||
/*[clinic end generated code: output=f1e5945e9763bcb9 input=90d162724944bfa7]*/
|
||||
{
|
||||
int match = tailmatch(self, prefix, 0, PY_SSIZE_T_MAX, -1);
|
||||
if (match == -1) {
|
||||
|
|
@ -12628,14 +12622,14 @@ str.removesuffix as unicode_removesuffix
|
|||
|
||||
Return a str with the given suffix string removed if present.
|
||||
|
||||
If the string ends with the suffix string and that suffix is not empty,
|
||||
return string[:-len(suffix)]. Otherwise, return a copy of the original
|
||||
string.
|
||||
If the string ends with the suffix string and that suffix is not
|
||||
empty, return string[:-len(suffix)]. Otherwise, return a copy of
|
||||
the original string.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
unicode_removesuffix_impl(PyObject *self, PyObject *suffix)
|
||||
/*[clinic end generated code: output=d36629e227636822 input=12cc32561e769be4]*/
|
||||
/*[clinic end generated code: output=d36629e227636822 input=6efc96152d4bfcd5]*/
|
||||
{
|
||||
int match = tailmatch(self, suffix, 0, PY_SSIZE_T_MAX, +1);
|
||||
if (match == -1) {
|
||||
|
|
@ -12745,14 +12739,14 @@ str.rfind as unicode_rfind = str.count
|
|||
|
||||
Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].
|
||||
|
||||
Optional arguments start and end are interpreted as in slice notation.
|
||||
Return -1 on failure.
|
||||
Optional arguments start and end are interpreted as in slice
|
||||
notation. Return -1 on failure.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static Py_ssize_t
|
||||
unicode_rfind_impl(PyObject *str, PyObject *substr, Py_ssize_t start,
|
||||
Py_ssize_t end)
|
||||
/*[clinic end generated code: output=880b29f01dd014c8 input=7f7e97d5cd3299a2]*/
|
||||
/*[clinic end generated code: output=880b29f01dd014c8 input=2e67789533baf2f5]*/
|
||||
{
|
||||
Py_ssize_t result = any_find_slice(str, substr, start, end, -1);
|
||||
if (result < 0) {
|
||||
|
|
@ -12767,14 +12761,14 @@ str.rindex as unicode_rindex = str.count
|
|||
|
||||
Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].
|
||||
|
||||
Optional arguments start and end are interpreted as in slice notation.
|
||||
Raises ValueError when the substring is not found.
|
||||
Optional arguments start and end are interpreted as in slice
|
||||
notation. Raises ValueError when the substring is not found.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static Py_ssize_t
|
||||
unicode_rindex_impl(PyObject *str, PyObject *substr, Py_ssize_t start,
|
||||
Py_ssize_t end)
|
||||
/*[clinic end generated code: output=5f3aef124c867fe1 input=0363a324740b3e62]*/
|
||||
/*[clinic end generated code: output=5f3aef124c867fe1 input=e29d446c8234c9d9]*/
|
||||
{
|
||||
Py_ssize_t result = any_find_slice(str, substr, start, end, -1);
|
||||
if (result == -1) {
|
||||
|
|
@ -12795,12 +12789,13 @@ str.rjust as unicode_rjust
|
|||
|
||||
Return a right-justified string of length width.
|
||||
|
||||
Padding is done using the specified fill character (default is a space).
|
||||
Padding is done using the specified fill character (default is
|
||||
a space).
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
unicode_rjust_impl(PyObject *self, Py_ssize_t width, Py_UCS4 fillchar)
|
||||
/*[clinic end generated code: output=804a1a57fbe8d5cf input=d05f550b5beb1f72]*/
|
||||
/*[clinic end generated code: output=804a1a57fbe8d5cf input=1256a8d659589907]*/
|
||||
{
|
||||
if (PyUnicode_GET_LENGTH(self) >= width)
|
||||
return unicode_result_unchanged(self);
|
||||
|
|
@ -12824,9 +12819,9 @@ str.split as unicode_split
|
|||
sep: object = None
|
||||
The separator used to split the string.
|
||||
|
||||
When set to None (the default value), will split on any whitespace
|
||||
character (including \n \r \t \f and spaces) and will discard
|
||||
empty strings from the result.
|
||||
When set to None (the default value), will split on any
|
||||
whitespace character (including \n \r \t \f and spaces) and
|
||||
will discard empty strings from the result.
|
||||
maxsplit: Py_ssize_t = -1
|
||||
Maximum number of splits.
|
||||
-1 (the default value) means no limit.
|
||||
|
|
@ -12835,15 +12830,15 @@ Return a list of the substrings in the string, using sep as the separator string
|
|||
|
||||
Splitting starts at the front of the string and works to the end.
|
||||
|
||||
Note, str.split() is mainly useful for data that has been intentionally
|
||||
delimited. With natural text that includes punctuation, consider using
|
||||
the regular expression module.
|
||||
Note, str.split() is mainly useful for data that has been
|
||||
intentionally delimited. With natural text that includes
|
||||
punctuation, consider using the regular expression module.
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
unicode_split_impl(PyObject *self, PyObject *sep, Py_ssize_t maxsplit)
|
||||
/*[clinic end generated code: output=3a65b1db356948dc input=2c1fd08a78e038b8]*/
|
||||
/*[clinic end generated code: output=3a65b1db356948dc input=288cfd6bc8828f5a]*/
|
||||
{
|
||||
if (sep == Py_None)
|
||||
return split(self, NULL, maxsplit);
|
||||
|
|
@ -12960,7 +12955,6 @@ PyUnicode_RPartition(PyObject *str_obj, PyObject *sep_obj)
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_docstring_body
|
||||
str.partition as unicode_partition
|
||||
|
||||
sep: object
|
||||
|
|
@ -12968,38 +12962,38 @@ str.partition as unicode_partition
|
|||
|
||||
Partition the string into three parts using the given separator.
|
||||
|
||||
This will search for the separator in the string. If the separator is found,
|
||||
returns a 3-tuple containing the part before the separator, the separator
|
||||
itself, and the part after it.
|
||||
This will search for the separator in the string. If the separator
|
||||
is found, returns a 3-tuple containing the part before the
|
||||
separator, the separator itself, and the part after it.
|
||||
|
||||
If the separator is not found, returns a 3-tuple containing the original string
|
||||
and two empty strings.
|
||||
If the separator is not found, returns a 3-tuple containing
|
||||
the original string and two empty strings.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
unicode_partition(PyObject *self, PyObject *sep)
|
||||
/*[clinic end generated code: output=e4ced7bd253ca3c4 input=4d854b520d7b0e97]*/
|
||||
/*[clinic end generated code: output=e4ced7bd253ca3c4 input=e45faa8c26270cb1]*/
|
||||
{
|
||||
return PyUnicode_Partition(self, sep);
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_docstring_body
|
||||
str.rpartition as unicode_rpartition = str.partition
|
||||
|
||||
Partition the string into three parts using the given separator.
|
||||
|
||||
This will search for the separator in the string, starting at the end. If
|
||||
the separator is found, returns a 3-tuple containing the part before the
|
||||
separator, the separator itself, and the part after it.
|
||||
This will search for the separator in the string, starting at the
|
||||
end. If the separator is found, returns a 3-tuple containing the
|
||||
part before the separator, the separator itself, and the part after
|
||||
it.
|
||||
|
||||
If the separator is not found, returns a 3-tuple containing two empty strings
|
||||
and the original string.
|
||||
If the separator is not found, returns a 3-tuple containing two
|
||||
empty strings and the original string.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
unicode_rpartition(PyObject *self, PyObject *sep)
|
||||
/*[clinic end generated code: output=1aa13cf1156572aa input=a6adabe91e75b486]*/
|
||||
/*[clinic end generated code: output=1aa13cf1156572aa input=53a7f8cb19975b7c]*/
|
||||
{
|
||||
return PyUnicode_RPartition(self, sep);
|
||||
}
|
||||
|
|
@ -13038,20 +13032,20 @@ unicode_rsplit_impl(PyObject *self, PyObject *sep, Py_ssize_t maxsplit)
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_docstring_body
|
||||
@permit_long_summary
|
||||
str.splitlines as unicode_splitlines
|
||||
|
||||
keepends: bool = False
|
||||
|
||||
Return a list of the lines in the string, breaking at line boundaries.
|
||||
|
||||
Line breaks are not included in the resulting list unless keepends is given and
|
||||
true.
|
||||
Line breaks are not included in the resulting list unless keepends
|
||||
is given and true.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
unicode_splitlines_impl(PyObject *self, int keepends)
|
||||
/*[clinic end generated code: output=f664dcdad153ec40 input=39eeafbfef61c827]*/
|
||||
/*[clinic end generated code: output=f664dcdad153ec40 input=b45ea0f87645a06d]*/
|
||||
{
|
||||
return PyUnicode_Splitlines(self, keepends);
|
||||
}
|
||||
|
|
@ -13130,18 +13124,19 @@ str.maketrans as unicode_maketrans
|
|||
|
||||
Return a translation table usable for str.translate().
|
||||
|
||||
If there is only one argument, it must be a dictionary mapping Unicode
|
||||
ordinals (integers) or characters to Unicode ordinals, strings or None.
|
||||
Character keys will be then converted to ordinals.
|
||||
If there are two arguments, they must be strings of equal length, and
|
||||
in the resulting dictionary, each character in x will be mapped to the
|
||||
character at the same position in y. If there is a third argument, it
|
||||
must be a string, whose characters will be mapped to None in the result.
|
||||
If there is only one argument, it must be a dictionary mapping
|
||||
Unicode ordinals (integers) or characters to Unicode ordinals,
|
||||
strings or None. Character keys will be then converted to ordinals.
|
||||
If there are two arguments, they must be strings of equal length,
|
||||
and in the resulting dictionary, each character in x will be mapped
|
||||
to the character at the same position in y. If there is a third
|
||||
argument, it must be a string, whose characters will be mapped to
|
||||
None in the result.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
unicode_maketrans_impl(PyObject *x, PyObject *y, PyObject *z)
|
||||
/*[clinic end generated code: output=a925c89452bd5881 input=7bfbf529a293c6c5]*/
|
||||
/*[clinic end generated code: output=a925c89452bd5881 input=66bc00a1b4258a6e]*/
|
||||
{
|
||||
PyObject *new = NULL, *key, *value;
|
||||
Py_ssize_t i = 0;
|
||||
|
|
@ -13221,24 +13216,25 @@ unicode_maketrans_impl(PyObject *x, PyObject *y, PyObject *z)
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_docstring_body
|
||||
@permit_long_summary
|
||||
str.translate as unicode_translate
|
||||
|
||||
table: object
|
||||
Translation table, which must be a mapping of Unicode ordinals to
|
||||
Unicode ordinals, strings, or None.
|
||||
Translation table, which must be a mapping of Unicode ordinals
|
||||
to Unicode ordinals, strings, or None.
|
||||
/
|
||||
|
||||
Replace each character in the string using the given translation table.
|
||||
|
||||
The table must implement lookup/indexing via __getitem__, for instance a
|
||||
dictionary or list. If this operation raises LookupError, the character is
|
||||
left untouched. Characters mapped to None are deleted.
|
||||
The table must implement lookup/indexing via __getitem__, for
|
||||
instance a dictionary or list. If this operation raises
|
||||
LookupError, the character is left untouched. Characters mapped to
|
||||
None are deleted.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
unicode_translate(PyObject *self, PyObject *table)
|
||||
/*[clinic end generated code: output=3cb448ff2fd96bf3 input=699e5fa0ebf9f5e9]*/
|
||||
/*[clinic end generated code: output=3cb448ff2fd96bf3 input=48cf0efe06bc1b75]*/
|
||||
{
|
||||
return _PyUnicode_TranslateCharmap(self, table, "ignore");
|
||||
}
|
||||
|
|
@ -13434,6 +13430,7 @@ Return a formatted version of the string, using substitutions from mapping.\n\
|
|||
The substitutions are identified by braces ('{' and '}').");
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_summary
|
||||
str.__format__ as unicode___format__
|
||||
|
||||
format_spec: unicode
|
||||
|
|
@ -13444,7 +13441,7 @@ Return a formatted version of the string as described by format_spec.
|
|||
|
||||
static PyObject *
|
||||
unicode___format___impl(PyObject *self, PyObject *format_spec)
|
||||
/*[clinic end generated code: output=45fceaca6d2ba4c8 input=5e135645d167a214]*/
|
||||
/*[clinic end generated code: output=45fceaca6d2ba4c8 input=77a2a19f3f7969f2]*/
|
||||
{
|
||||
_PyUnicodeWriter writer;
|
||||
int ret;
|
||||
|
|
|
|||
|
|
@ -252,7 +252,6 @@ PyDoc_STRVAR(build_class_doc,
|
|||
Internal helper function used by the class statement.");
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_docstring_body
|
||||
__import__ as builtin___import__
|
||||
|
||||
name: object
|
||||
|
|
@ -273,15 +272,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=01a3283590eae93a]*/
|
||||
/*[clinic end generated code: output=4febeda88a0cd245 input=e3096a230383f72d]*/
|
||||
{
|
||||
return PyImport_ImportModuleLevelObject(name, globals, locals,
|
||||
fromlist, level);
|
||||
|
|
@ -299,15 +299,15 @@ __lazy_import__ as builtin___lazy_import__
|
|||
|
||||
Lazily imports a module.
|
||||
|
||||
Returns either the module to be imported or a imp.lazy_module object which
|
||||
indicates the module to be lazily imported.
|
||||
Returns either the module to be imported or a imp.lazy_module object
|
||||
which indicates the module to be lazily imported.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
builtin___lazy_import___impl(PyObject *module, PyObject *name,
|
||||
PyObject *globals, PyObject *locals,
|
||||
PyObject *fromlist, int level)
|
||||
/*[clinic end generated code: output=300f1771094b9e8c input=9394874f340b2948]*/
|
||||
/*[clinic end generated code: output=300f1771094b9e8c input=9c85cccd6a885b9b]*/
|
||||
{
|
||||
PyObject *builtins;
|
||||
PyThreadState *tstate = PyThreadState_GET();
|
||||
|
|
@ -696,8 +696,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)
|
||||
|
|
@ -770,6 +771,7 @@ builtin_format_impl(PyObject *module, PyObject *value, PyObject *format_spec)
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_summary
|
||||
chr as builtin_chr
|
||||
|
||||
i: object
|
||||
|
|
@ -780,7 +782,7 @@ Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff.
|
|||
|
||||
static PyObject *
|
||||
builtin_chr(PyObject *module, PyObject *i)
|
||||
/*[clinic end generated code: output=d34f25b8035a9b10 input=f919867f0ba2f496]*/
|
||||
/*[clinic end generated code: output=d34f25b8035a9b10 input=a9b255f2d2e503f0]*/
|
||||
{
|
||||
int overflow;
|
||||
long v = PyLong_AsLongAndOverflow(i, &overflow);
|
||||
|
|
@ -804,6 +806,7 @@ builtin_chr(PyObject *module, PyObject *i)
|
|||
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_summary
|
||||
compile as builtin_compile
|
||||
|
||||
source: object
|
||||
|
|
@ -818,23 +821,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, PyObject *modname, int feature_version)
|
||||
/*[clinic end generated code: output=9a0dce1945917a86 input=ddeae1e0253459dc]*/
|
||||
/*[clinic end generated code: output=9a0dce1945917a86 input=444c4fe466a97279]*/
|
||||
{
|
||||
PyObject *source_copy;
|
||||
const char *str;
|
||||
|
|
@ -982,10 +986,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"
|
||||
|
|
@ -1326,9 +1330,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]
|
||||
|
|
@ -1336,13 +1342,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 *globals;
|
||||
if (_PyEval_GetFrame() != NULL) {
|
||||
|
|
@ -1695,8 +1701,8 @@ PyDoc_STRVAR(map_doc,
|
|||
Make an iterator that computes the function using arguments from\n\
|
||||
each of the iterables. Stops when the shortest iterable is exhausted.\n\
|
||||
\n\
|
||||
If strict is true and one of the arguments is exhausted before the others,\n\
|
||||
raise a ValueError.");
|
||||
If strict is true and one of the arguments is exhausted before the\n\
|
||||
others, raise a ValueError.");
|
||||
|
||||
PyTypeObject PyMap_Type = {
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
|
|
@ -1783,8 +1789,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]
|
||||
|
|
@ -1907,7 +1913,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]
|
||||
|
|
@ -2001,14 +2008,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]*/
|
||||
{
|
||||
PyObject *locals;
|
||||
if (_PyEval_GetFrame() != NULL) {
|
||||
|
|
@ -2260,6 +2268,7 @@ builtin_ord(PyObject *module, PyObject *c)
|
|||
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_summary
|
||||
pow as builtin_pow
|
||||
|
||||
base: object
|
||||
|
|
@ -2268,14 +2277,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=0cd5c3ecc8003aec]*/
|
||||
{
|
||||
return PyNumber_Power(base, exp, mod);
|
||||
}
|
||||
|
|
@ -2396,13 +2405,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;
|
||||
|
|
@ -2670,13 +2680,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 *result;
|
||||
if (ndigits == Py_None) {
|
||||
|
|
@ -2708,8 +2719,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__,
|
||||
|
|
@ -2843,6 +2854,7 @@ cs_to_double(CompensatedSum total)
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_summary
|
||||
sum as builtin_sum
|
||||
|
||||
iterable: object
|
||||
|
|
@ -2852,13 +2864,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=d464d57815196b73]*/
|
||||
{
|
||||
PyObject *result = start;
|
||||
PyObject *temp, *item, *iter;
|
||||
|
|
@ -3094,6 +3106,7 @@ builtin_sum_impl(PyObject *module, PyObject *iterable, PyObject *start)
|
|||
|
||||
|
||||
/*[clinic input]
|
||||
@permit_long_summary
|
||||
isinstance as builtin_isinstance
|
||||
|
||||
obj: object
|
||||
|
|
@ -3102,15 +3115,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=5d74d547df498f38]*/
|
||||
{
|
||||
int retval;
|
||||
|
||||
|
|
@ -3130,15 +3143,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;
|
||||
|
||||
|
|
@ -3368,13 +3381,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)]");
|
||||
|
|
|
|||
63
Python/clinic/bltinmodule.c.h
generated
63
Python/clinic/bltinmodule.c.h
generated
|
|
@ -25,9 +25,10 @@ PyDoc_STRVAR(builtin___import____doc__,
|
|||
"empty list to emulate ``import name``.\n"
|
||||
"When importing a module from a package, note that __import__(\'A.B\', ...)\n"
|
||||
"returns package A when fromlist is empty, but its submodule B when\n"
|
||||
"fromlist is not empty. The level argument is used to determine whether to\n"
|
||||
"perform absolute or relative imports: 0 is absolute, while a positive number\n"
|
||||
"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\n"
|
||||
"to perform absolute or relative imports: 0 is absolute, while a positive\n"
|
||||
"number is the number of parent directories to search relative to the\n"
|
||||
"current module.");
|
||||
|
||||
#define BUILTIN___IMPORT___METHODDEF \
|
||||
{"__import__", _PyCFunction_CAST(builtin___import__), METH_FASTCALL|METH_KEYWORDS, builtin___import____doc__},
|
||||
|
|
@ -120,8 +121,8 @@ PyDoc_STRVAR(builtin___lazy_import____doc__,
|
|||
"\n"
|
||||
"Lazily imports a module.\n"
|
||||
"\n"
|
||||
"Returns either the module to be imported or a imp.lazy_module object which\n"
|
||||
"indicates the module to be lazily imported.");
|
||||
"Returns either the module to be imported or a imp.lazy_module object\n"
|
||||
"which indicates the module to be lazily imported.");
|
||||
|
||||
#define BUILTIN___LAZY_IMPORT___METHODDEF \
|
||||
{"__lazy_import__", _PyCFunction_CAST(builtin___lazy_import__), METH_FASTCALL|METH_KEYWORDS, builtin___lazy_import____doc__},
|
||||
|
|
@ -339,16 +340,17 @@ PyDoc_STRVAR(builtin_compile__doc__,
|
|||
"\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 source code may represent a Python module, statement or\n"
|
||||
"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 flags argument, if present, controls which future statements\n"
|
||||
"influence the compilation of the code.\n"
|
||||
"The dont_inherit argument, if true, stops the compilation inheriting\n"
|
||||
"the effects of any future statements in effect in the code calling\n"
|
||||
"compile; if absent or false these statements do influence the compilation,\n"
|
||||
"in addition to any features explicitly specified.");
|
||||
"compile; if absent or false these statements do influence the\n"
|
||||
"compilation, in addition to any features explicitly specified.");
|
||||
|
||||
#define BUILTIN_COMPILE_METHODDEF \
|
||||
{"compile", _PyCFunction_CAST(builtin_compile), METH_FASTCALL|METH_KEYWORDS, builtin_compile__doc__},
|
||||
|
|
@ -683,8 +685,8 @@ PyDoc_STRVAR(builtin_globals__doc__,
|
|||
"\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.");
|
||||
"NOTE: Updates to this dictionary *will* affect name lookups in the\n"
|
||||
"current global scope and vice-versa.");
|
||||
|
||||
#define BUILTIN_GLOBALS_METHODDEF \
|
||||
{"globals", (PyCFunction)builtin_globals, METH_NOARGS, builtin_globals__doc__},
|
||||
|
|
@ -910,9 +912,10 @@ PyDoc_STRVAR(builtin_locals__doc__,
|
|||
"\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.");
|
||||
"NOTE: Whether or not updates to this dictionary will affect name\n"
|
||||
"lookups in the local scope and vice-versa is *implementation\n"
|
||||
"dependent* and not covered by any backwards compatibility\n"
|
||||
"guarantees.");
|
||||
|
||||
#define BUILTIN_LOCALS_METHODDEF \
|
||||
{"locals", (PyCFunction)builtin_locals, METH_NOARGS, builtin_locals__doc__},
|
||||
|
|
@ -959,8 +962,8 @@ PyDoc_STRVAR(builtin_pow__doc__,
|
|||
"\n"
|
||||
"Equivalent to base**exp with 2 arguments or base**exp % mod with 3 arguments\n"
|
||||
"\n"
|
||||
"Some types, such as ints, are able to use a more efficient algorithm when\n"
|
||||
"invoked using the three argument form.");
|
||||
"Some types, such as ints, are able to use a more efficient algorithm\n"
|
||||
"when invoked using the three argument form.");
|
||||
|
||||
#define BUILTIN_POW_METHODDEF \
|
||||
{"pow", _PyCFunction_CAST(builtin_pow), METH_FASTCALL|METH_KEYWORDS, builtin_pow__doc__},
|
||||
|
|
@ -1136,7 +1139,8 @@ PyDoc_STRVAR(builtin_input__doc__,
|
|||
"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"
|
||||
"If the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise\n"
|
||||
"EOFError.\n"
|
||||
"On *nix systems, readline is used if available.");
|
||||
|
||||
#define BUILTIN_INPUT_METHODDEF \
|
||||
|
|
@ -1182,8 +1186,9 @@ PyDoc_STRVAR(builtin_round__doc__,
|
|||
"\n"
|
||||
"Round a number to a given precision in decimal digits.\n"
|
||||
"\n"
|
||||
"The return value is an integer if ndigits is omitted or None. Otherwise\n"
|
||||
"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.\n"
|
||||
"Otherwise the return value has the same type as the number. ndigits\n"
|
||||
"may be negative.");
|
||||
|
||||
#define BUILTIN_ROUND_METHODDEF \
|
||||
{"round", _PyCFunction_CAST(builtin_round), METH_FASTCALL|METH_KEYWORDS, builtin_round__doc__},
|
||||
|
|
@ -1251,8 +1256,8 @@ PyDoc_STRVAR(builtin_sum__doc__,
|
|||
"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.");
|
||||
"This function is intended specifically for use with numeric values and\n"
|
||||
"may reject non-numeric types.");
|
||||
|
||||
#define BUILTIN_SUM_METHODDEF \
|
||||
{"sum", _PyCFunction_CAST(builtin_sum), METH_FASTCALL|METH_KEYWORDS, builtin_sum__doc__},
|
||||
|
|
@ -1319,9 +1324,9 @@ PyDoc_STRVAR(builtin_isinstance__doc__,
|
|||
"\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.");
|
||||
"A tuple, as in ``isinstance(x, (A, B, ...))``, may be given as the\n"
|
||||
"target to check against. This is equivalent to ``isinstance(x, A) or\n"
|
||||
"isinstance(x, B) or ...`` etc.");
|
||||
|
||||
#define BUILTIN_ISINSTANCE_METHODDEF \
|
||||
{"isinstance", _PyCFunction_CAST(builtin_isinstance), METH_FASTCALL, builtin_isinstance__doc__},
|
||||
|
|
@ -1354,9 +1359,9 @@ PyDoc_STRVAR(builtin_issubclass__doc__,
|
|||
"\n"
|
||||
"Return whether \'cls\' is 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 ...``.");
|
||||
"A tuple, as in ``issubclass(x, (A, B, ...))``, may be given as the\n"
|
||||
"target to check against. This is equivalent to ``issubclass(x, A) or\n"
|
||||
"issubclass(x, B) or ...``.");
|
||||
|
||||
#define BUILTIN_ISSUBCLASS_METHODDEF \
|
||||
{"issubclass", _PyCFunction_CAST(builtin_issubclass), METH_FASTCALL, builtin_issubclass__doc__},
|
||||
|
|
@ -1382,4 +1387,4 @@ builtin_issubclass(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=f1fc836a63d89826 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=84efa9c5cc737ce5 input=a9049054013a1b77]*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue