Skip to content

Commit 962dcc9

Browse files
serhiy-storchakamiss-islington
authored andcommitted
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. (cherry picked from commit e1e06be) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
1 parent c3d21e5 commit 962dcc9

26 files changed

Lines changed: 613 additions & 553 deletions

Objects/bytearrayobject.c

Lines changed: 50 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,6 +1620,7 @@ bytearray_take_bytes_impl(PyByteArrayObject *self, PyObject *n)
16201620

16211621

16221622
/*[clinic input]
1623+
@permit_long_summary
16231624
@critical_section
16241625
bytearray.translate
16251626
@@ -1630,14 +1631,15 @@ bytearray.translate
16301631
16311632
Return a copy with each character mapped by the given translation table.
16321633
1633-
All characters occurring in the optional argument delete are removed.
1634-
The remaining characters are mapped through the given translation table.
1634+
All characters occurring in the optional argument delete are
1635+
removed. The remaining characters are mapped through the given
1636+
translation table.
16351637
[clinic start generated code]*/
16361638

16371639
static PyObject *
16381640
bytearray_translate_impl(PyByteArrayObject *self, PyObject *table,
16391641
PyObject *deletechars)
1640-
/*[clinic end generated code: output=b6a8f01c2a74e446 input=cd6fa93ca04e05bc]*/
1642+
/*[clinic end generated code: output=b6a8f01c2a74e446 input=e30d2ae004365ed9]*/
16411643
{
16421644
char *input, *output;
16431645
const char *table_chars;
@@ -1727,7 +1729,6 @@ bytearray_translate_impl(PyByteArrayObject *self, PyObject *table,
17271729
/*[clinic input]
17281730
17291731
@permit_long_summary
1730-
@permit_long_docstring_body
17311732
@staticmethod
17321733
bytearray.maketrans
17331734
@@ -1737,15 +1738,15 @@ bytearray.maketrans
17371738
17381739
Return a translation table usable for the bytes or bytearray translate method.
17391740
1740-
The returned table will be one where each byte in frm is mapped to the byte at
1741-
the same position in to.
1741+
The returned table will be one where each byte in frm is mapped to
1742+
the byte at the same position in to.
17421743
17431744
The bytes objects frm and to must be of the same length.
17441745
[clinic start generated code]*/
17451746

17461747
static PyObject *
17471748
bytearray_maketrans_impl(Py_buffer *frm, Py_buffer *to)
1748-
/*[clinic end generated code: output=1df267d99f56b15e input=1146b43a592eca13]*/
1749+
/*[clinic end generated code: output=1df267d99f56b15e input=c2f5f6e7e6b0221d]*/
17491750
{
17501751
return _Py_bytes_maketrans(frm, to);
17511752
}
@@ -1785,8 +1786,8 @@ bytearray.split
17851786
17861787
sep: object = None
17871788
The delimiter according which to split the bytearray.
1788-
None (the default value) means split on ASCII whitespace characters
1789-
(space, tab, return, newline, formfeed, vertical tab).
1789+
None (the default value) means split on ASCII whitespace
1790+
characters (space, tab, return, newline, formfeed, vertical tab).
17901791
maxsplit: Py_ssize_t = -1
17911792
Maximum number of splits to do.
17921793
-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.
17971798
static PyObject *
17981799
bytearray_split_impl(PyByteArrayObject *self, PyObject *sep,
17991800
Py_ssize_t maxsplit)
1800-
/*[clinic end generated code: output=833e2cf385d9a04d input=dd9f6e2910cc3a34]*/
1801+
/*[clinic end generated code: output=833e2cf385d9a04d input=45605178023b52ac]*/
18011802
{
18021803
PyObject *list = NULL;
18031804

@@ -1829,7 +1830,6 @@ bytearray_split_impl(PyByteArrayObject *self, PyObject *sep,
18291830
}
18301831

18311832
/*[clinic input]
1832-
@permit_long_docstring_body
18331833
@critical_section
18341834
bytearray.partition
18351835
@@ -1838,17 +1838,18 @@ bytearray.partition
18381838
18391839
Partition the bytearray into three parts using the given separator.
18401840
1841-
This will search for the separator sep in the bytearray. If the separator is
1842-
found, returns a 3-tuple containing the part before the separator, the
1843-
separator itself, and the part after it as new bytearray objects.
1841+
This will search for the separator sep in the bytearray. If the
1842+
separator is found, returns a 3-tuple containing the part before the
1843+
separator, the separator itself, and the part after it as new
1844+
bytearray objects.
18441845
1845-
If the separator is not found, returns a 3-tuple containing the copy of the
1846-
original bytearray object and two empty bytearray objects.
1846+
If the separator is not found, returns a 3-tuple containing the copy
1847+
of the original bytearray object and two empty bytearray objects.
18471848
[clinic start generated code]*/
18481849

18491850
static PyObject *
18501851
bytearray_partition_impl(PyByteArrayObject *self, PyObject *sep)
1851-
/*[clinic end generated code: output=b5fa1e03f10cfccb input=b87276af883f39d9]*/
1852+
/*[clinic end generated code: output=b5fa1e03f10cfccb input=d76673ed03acf5dd]*/
18521853
{
18531854
PyObject *bytesep, *result;
18541855

@@ -1868,7 +1869,6 @@ bytearray_partition_impl(PyByteArrayObject *self, PyObject *sep)
18681869
}
18691870

18701871
/*[clinic input]
1871-
@permit_long_docstring_body
18721872
@critical_section
18731873
bytearray.rpartition
18741874
@@ -1877,18 +1877,19 @@ bytearray.rpartition
18771877
18781878
Partition the bytearray into three parts using the given separator.
18791879
1880-
This will search for the separator sep in the bytearray, starting at the end.
1881-
If the separator is found, returns a 3-tuple containing the part before the
1882-
separator, the separator itself, and the part after it as new bytearray
1883-
objects.
1880+
This will search for the separator sep in the bytearray, starting at
1881+
the end. If the separator is found, returns a 3-tuple containing
1882+
the part before the separator, the separator itself, and the part
1883+
after it as new bytearray objects.
18841884
1885-
If the separator is not found, returns a 3-tuple containing two empty bytearray
1886-
objects and the copy of the original bytearray object.
1885+
If the separator is not found, returns a 3-tuple containing two
1886+
empty bytearray objects and the copy of the original bytearray
1887+
object.
18871888
[clinic start generated code]*/
18881889

18891890
static PyObject *
18901891
bytearray_rpartition_impl(PyByteArrayObject *self, PyObject *sep)
1891-
/*[clinic end generated code: output=0186ce7b1ef61289 input=5bdcfc4c333bcfab]*/
1892+
/*[clinic end generated code: output=0186ce7b1ef61289 input=b9216a2074174a36]*/
18921893
{
18931894
PyObject *bytesep, *result;
18941895

@@ -1909,19 +1910,19 @@ bytearray_rpartition_impl(PyByteArrayObject *self, PyObject *sep)
19091910

19101911
/*[clinic input]
19111912
@permit_long_summary
1912-
@permit_long_docstring_body
19131913
@critical_section
19141914
bytearray.rsplit = bytearray.split
19151915
19161916
Return a list of the sections in the bytearray, using sep as the delimiter.
19171917
1918-
Splitting is done starting at the end of the bytearray and working to the front.
1918+
Splitting is done starting at the end of the bytearray and working
1919+
to the front.
19191920
[clinic start generated code]*/
19201921

19211922
static PyObject *
19221923
bytearray_rsplit_impl(PyByteArrayObject *self, PyObject *sep,
19231924
Py_ssize_t maxsplit)
1924-
/*[clinic end generated code: output=a55e0b5a03cb6190 input=60e9abf305128ff4]*/
1925+
/*[clinic end generated code: output=a55e0b5a03cb6190 input=e201671c9a0c19ee]*/
19251926
{
19261927
PyObject *list = NULL;
19271928

@@ -2392,7 +2393,6 @@ bytearray_strip_impl_helper(PyByteArrayObject* self, PyObject* bytes, int stript
23922393
}
23932394

23942395
/*[clinic input]
2395-
@permit_long_docstring_body
23962396
@critical_section
23972397
bytearray.strip
23982398
@@ -2401,12 +2401,13 @@ bytearray.strip
24012401
24022402
Strip leading and trailing bytes contained in the argument.
24032403
2404-
If the argument is omitted or None, strip leading and trailing ASCII whitespace.
2404+
If the argument is omitted or None, strip leading and trailing ASCII
2405+
whitespace.
24052406
[clinic start generated code]*/
24062407

24072408
static PyObject *
24082409
bytearray_strip_impl(PyByteArrayObject *self, PyObject *bytes)
2409-
/*[clinic end generated code: output=760412661a34ad5a input=6acaf88b2ec9daa7]*/
2410+
/*[clinic end generated code: output=760412661a34ad5a input=f4ec5fa609df7d14]*/
24102411
{
24112412
return bytearray_strip_impl_helper(self, bytes, BOTHSTRIP);
24122413
}
@@ -2506,19 +2507,19 @@ bytearray.decode
25062507
encoding: str(c_default="NULL") = 'utf-8'
25072508
The encoding with which to decode the bytearray.
25082509
errors: str(c_default="NULL") = 'strict'
2509-
The error handling scheme to use for the handling of decoding errors.
2510-
The default is 'strict' meaning that decoding errors raise a
2511-
UnicodeDecodeError. Other possible values are 'ignore' and 'replace'
2512-
as well as any other name registered with codecs.register_error that
2513-
can handle UnicodeDecodeErrors.
2510+
The error handling scheme to use for the handling of decoding
2511+
errors. The default is 'strict' meaning that decoding errors
2512+
raise a UnicodeDecodeError. Other possible values are 'ignore'
2513+
and 'replace' as well as any other name registered with
2514+
codecs.register_error that can handle UnicodeDecodeErrors.
25142515
25152516
Decode the bytearray using the codec registered for encoding.
25162517
[clinic start generated code]*/
25172518

25182519
static PyObject *
25192520
bytearray_decode_impl(PyByteArrayObject *self, const char *encoding,
25202521
const char *errors)
2521-
/*[clinic end generated code: output=f57d43f4a00b42c5 input=86c303ee376b8453]*/
2522+
/*[clinic end generated code: output=f57d43f4a00b42c5 input=e51ce9b82b51e2ca]*/
25222523
{
25232524
if (encoding == NULL)
25242525
encoding = PyUnicode_GetDefaultEncoding();
@@ -2550,14 +2551,15 @@ bytearray.join
25502551
25512552
Concatenate any number of bytes/bytearray objects.
25522553
2553-
The bytearray whose method is called is inserted in between each pair.
2554+
The bytearray whose method is called is inserted in between each
2555+
pair.
25542556
25552557
The result is returned as a new bytearray object.
25562558
[clinic start generated code]*/
25572559

25582560
static PyObject *
25592561
bytearray_join_impl(PyByteArrayObject *self, PyObject *iterable_of_bytes)
2560-
/*[clinic end generated code: output=0ced382b5846a7ee input=49627e07ca31ca26]*/
2562+
/*[clinic end generated code: output=0ced382b5846a7ee input=0a31db349efcd7fa]*/
25612563
{
25622564
PyObject *ret;
25632565
self->ob_exports++; // this protects `self` from being cleared/resized if `iterable_of_bytes` is a custom iterator
@@ -2588,21 +2590,20 @@ bytearray_rjust(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
25882590

25892591
/*[clinic input]
25902592
@permit_long_summary
2591-
@permit_long_docstring_body
25922593
@critical_section
25932594
bytearray.splitlines
25942595
25952596
keepends: bool = False
25962597
25972598
Return a list of the lines in the bytearray, breaking at line boundaries.
25982599
2599-
Line breaks are not included in the resulting list unless keepends is given and
2600-
true.
2600+
Line breaks are not included in the resulting list unless keepends
2601+
is given and true.
26012602
[clinic start generated code]*/
26022603

26032604
static PyObject *
26042605
bytearray_splitlines_impl(PyByteArrayObject *self, int keepends)
2605-
/*[clinic end generated code: output=4223c94b895f6ad9 input=21bc3f02bf1be832]*/
2606+
/*[clinic end generated code: output=4223c94b895f6ad9 input=cc2bb740eed19f27]*/
26062607
{
26072608
return stringlib_splitlines(
26082609
(PyObject*) self, PyByteArray_AS_STRING(self),
@@ -2620,12 +2621,13 @@ bytearray.fromhex
26202621
Create a bytearray object from a string of hexadecimal numbers.
26212622
26222623
Spaces between two numbers are accepted.
2623-
Example: bytearray.fromhex('B9 01EF') -> bytearray(b'\\xb9\\x01\\xef')
2624+
Example:
2625+
bytearray.fromhex('B9 01EF') -> bytearray(b'\\xb9\\x01\\xef')
26242626
[clinic start generated code]*/
26252627

26262628
static PyObject *
26272629
bytearray_fromhex_impl(PyTypeObject *type, PyObject *string)
2628-
/*[clinic end generated code: output=8f0f0b6d30fb3ba0 input=7e314e5b2d7ab484]*/
2630+
/*[clinic end generated code: output=8f0f0b6d30fb3ba0 input=2243a8b0b9e66cd5]*/
26292631
{
26302632
PyObject *result = _PyBytes_FromHex(string, type == &PyByteArray_Type);
26312633
if (type != &PyByteArray_Type && result != NULL) {
@@ -2641,8 +2643,8 @@ bytearray.hex
26412643
sep: object = NULL
26422644
An optional single character or byte to separate hex bytes.
26432645
bytes_per_sep: Py_ssize_t = 1
2644-
How many bytes between separators. Positive values count from the
2645-
right, negative values count from the left.
2646+
How many bytes between separators. Positive values count from
2647+
the right, negative values count from the left.
26462648
26472649
Create a string of hexadecimal numbers from a bytearray object.
26482650
@@ -2661,7 +2663,7 @@ Create a string of hexadecimal numbers from a bytearray object.
26612663
static PyObject *
26622664
bytearray_hex_impl(PyByteArrayObject *self, PyObject *sep,
26632665
Py_ssize_t bytes_per_sep)
2664-
/*[clinic end generated code: output=c9563921aff1262b input=d2b23ef057cfcad5]*/
2666+
/*[clinic end generated code: output=c9563921aff1262b input=9ed746203691e894]*/
26652667
{
26662668
char* argbuf = PyByteArray_AS_STRING(self);
26672669
Py_ssize_t arglen = PyByteArray_GET_SIZE(self);

Objects/bytes_methods.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,8 @@ _Py_bytes_upper(char *result, const char *cptr, Py_ssize_t len)
277277
PyDoc_STRVAR_shared(_Py_title__doc__,
278278
"B.title() -> copy of B\n\
279279
\n\
280-
Return a titlecased version of B, i.e. ASCII words start with uppercase\n\
281-
characters, all remaining cased characters have lowercase.");
280+
Return a titlecased version of B, i.e. ASCII words start with\n\
281+
uppercase characters, all remaining cased characters have lowercase.");
282282

283283
void
284284
_Py_bytes_title(char *result, const char *s, Py_ssize_t len)

0 commit comments

Comments
 (0)