summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/Objects/bytesobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/tools/python3/Objects/bytesobject.c')
-rw-r--r--contrib/tools/python3/Objects/bytesobject.c94
1 files changed, 50 insertions, 44 deletions
diff --git a/contrib/tools/python3/Objects/bytesobject.c b/contrib/tools/python3/Objects/bytesobject.c
index d891121589f..af6ca7270b0 100644
--- a/contrib/tools/python3/Objects/bytesobject.c
+++ b/contrib/tools/python3/Objects/bytesobject.c
@@ -1752,8 +1752,8 @@ 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.
@@ -1763,7 +1763,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=9c0faeffc870f672]*/
{
Py_ssize_t len = PyBytes_GET_SIZE(self), n;
const char *s = PyBytes_AS_STRING(self), *sub;
@@ -1792,17 +1792,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=61cca95519406099]*/
+/*[clinic end generated code: output=f532b392a17ff695 input=2e6e551ea4f8b95a]*/
{
return stringlib_partition(
(PyObject*) self,
@@ -1819,17 +1819,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=d78db010c8cfdbe1]*/
+/*[clinic end generated code: output=191b114cbb028e50 input=f7d24f722a5470a4]*/
{
return stringlib_rpartition(
(PyObject*) self,
@@ -1843,12 +1844,13 @@ 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=0f86c9f28f7d7b7b]*/
+/*[clinic end generated code: output=ba698d9ea01e1c8f input=7fd643d4337b6a9b]*/
{
Py_ssize_t len = PyBytes_GET_SIZE(self), n;
const char *s = PyBytes_AS_STRING(self), *sub;
@@ -2063,12 +2065,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=8a354640e4e0b3ef]*/
+/*[clinic end generated code: output=c7c228d3bd104a1b input=9ffea5f752032bd0]*/
{
return do_argstrip(self, BOTHSTRIP, bytes);
}
@@ -2136,14 +2139,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=4e4460a981d768c5]*/
{
const char *input;
char *output;
@@ -2265,15 +2269,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=a3bd00d430a0979f]*/
+/*[clinic end generated code: output=a36f6399d4b77f6f input=c88bcc17621f785d]*/
{
return _Py_bytes_maketrans(frm, to);
}
@@ -2315,13 +2319,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=8f371f9421b8addd]*/
{
const char *self_start = PyBytes_AS_STRING(self);
Py_ssize_t self_len = PyBytes_GET_SIZE(self);
@@ -2351,14 +2356,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=35eada0260d1171b]*/
{
const char *self_start = PyBytes_AS_STRING(self);
Py_ssize_t self_len = PyBytes_GET_SIZE(self);
@@ -2436,11 +2441,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]*/
@@ -2448,7 +2453,7 @@ 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);
}
@@ -2461,13 +2466,13 @@ bytes.splitlines
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=5d7b898af2fe55c0]*/
+/*[clinic end generated code: output=3484149a5d880ffb input=8b7b6915be775bcf]*/
{
return stringlib_splitlines(
(PyObject*) self, PyBytes_AS_STRING(self),
@@ -2579,9 +2584,10 @@ bytes.hex
sep: object = NULL
An optional single character or byte to separate hex bytes.
+
bytes_per_sep: int = 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.
@@ -2599,7 +2605,7 @@ Example:
static PyObject *
bytes_hex_impl(PyBytesObject *self, PyObject *sep, int bytes_per_sep)
-/*[clinic end generated code: output=1f134da504064139 input=1a21282b1f1ae595]*/
+/*[clinic end generated code: output=1f134da504064139 input=67d7bb5f70f0d6f2]*/
{
const char *argbuf = PyBytes_AS_STRING(self);
Py_ssize_t arglen = PyBytes_GET_SIZE(self);