Skip to content

Commit 49975a5

Browse files
[3.14] gh-150285: Fix too long docstrings in Argument Clinic code (GH-150338) (GH-150350) (GH-150473)
(cherry picked from commit cf73b17) (cherry picked from commit 287c98f)
1 parent 26c5468 commit 49975a5

71 files changed

Lines changed: 590 additions & 535 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Modules/_abc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -911,14 +911,14 @@ _abc.get_cache_token
911911
912912
Returns the current ABC cache token.
913913
914-
The token is an opaque object (supporting equality testing) identifying the
915-
current version of the ABC cache for virtual subclasses. The token changes
916-
with every call to register() on any ABC.
914+
The token is an opaque object (supporting equality testing) identifying
915+
the current version of the ABC cache for virtual subclasses. The token
916+
changes with every call to register() on any ABC.
917917
[clinic start generated code]*/
918918

919919
static PyObject *
920920
_abc_get_cache_token_impl(PyObject *module)
921-
/*[clinic end generated code: output=c7d87841e033dacc input=70413d1c423ad9f9]*/
921+
/*[clinic end generated code: output=c7d87841e033dacc input=d87acc04492f6bf3]*/
922922
{
923923
_abcmodule_state *state = get_abc_state(module);
924924
return PyLong_FromUnsignedLongLong(get_invalidation_counter(state));

Modules/_asynciomodule.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -966,12 +966,13 @@ Return the result this future represents.
966966
967967
If the future has been cancelled, raises CancelledError. If the
968968
future's result isn't yet available, raises InvalidStateError. If
969-
the future is done and has an exception set, this exception is raised.
969+
the future is done and has an exception set, this exception is
970+
raised.
970971
[clinic start generated code]*/
971972

972973
static PyObject *
973974
_asyncio_Future_result_impl(FutureObj *self)
974-
/*[clinic end generated code: output=f35f940936a4b1e5 input=61d89f48e4c8b670]*/
975+
/*[clinic end generated code: output=f35f940936a4b1e5 input=ee20e126776cbb04]*/
975976
{
976977
asyncio_state *state = get_asyncio_state_by_def((PyObject *)self);
977978
PyObject *result;
@@ -1106,15 +1107,15 @@ _asyncio.Future.add_done_callback
11061107
11071108
Add a callback to be run when the future becomes done.
11081109
1109-
The callback is called with a single argument - the future object. If
1110-
the future is already done when this is called, the callback is
1110+
The callback is called with a single argument - the future object.
1111+
If the future is already done when this is called, the callback is
11111112
scheduled with call_soon.
11121113
[clinic start generated code]*/
11131114

11141115
static PyObject *
11151116
_asyncio_Future_add_done_callback_impl(FutureObj *self, PyTypeObject *cls,
11161117
PyObject *fn, PyObject *context)
1117-
/*[clinic end generated code: output=922e9a4cbd601167 input=37d97f941beb7b3e]*/
1118+
/*[clinic end generated code: output=922e9a4cbd601167 input=f4f6adb074cd3e0f]*/
11181119
{
11191120
asyncio_state *state = get_asyncio_state_by_cls(cls);
11201121
if (context == NULL) {
@@ -1263,15 +1264,15 @@ _asyncio.Future.cancel
12631264
12641265
Cancel the future and schedule callbacks.
12651266
1266-
If the future is already done or cancelled, return False. Otherwise,
1267-
change the future's state to cancelled, schedule the callbacks and
1268-
return True.
1267+
If the future is already done or cancelled, return False.
1268+
Otherwise, change the future's state to cancelled, schedule the
1269+
callbacks and return True.
12691270
[clinic start generated code]*/
12701271

12711272
static PyObject *
12721273
_asyncio_Future_cancel_impl(FutureObj *self, PyTypeObject *cls,
12731274
PyObject *msg)
1274-
/*[clinic end generated code: output=074956f35904b034 input=44ab4003da839970]*/
1275+
/*[clinic end generated code: output=074956f35904b034 input=0c9157547a964c4c]*/
12751276
{
12761277
asyncio_state *state = get_asyncio_state_by_cls(cls);
12771278
ENSURE_FUTURE_ALIVE(state, self)
@@ -1303,13 +1304,13 @@ _asyncio.Future.done
13031304
13041305
Return True if the future is done.
13051306
1306-
Done means either that a result / exception are available, or that the
1307-
future was cancelled.
1307+
Done means either that a result / exception are available, or that
1308+
the future was cancelled.
13081309
[clinic start generated code]*/
13091310

13101311
static PyObject *
13111312
_asyncio_Future_done_impl(FutureObj *self)
1312-
/*[clinic end generated code: output=244c5ac351145096 input=7204d3cc63bef7f3]*/
1313+
/*[clinic end generated code: output=244c5ac351145096 input=acf2c2347f3c01d8]*/
13131314
{
13141315
if (!future_is_alive(self) || self->fut_state == STATE_PENDING) {
13151316
Py_RETURN_FALSE;

Modules/_bisectmodule.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ _bisect.bisect_right -> Py_ssize_t
161161
Return the index where to insert item x in list a, assuming a is sorted.
162162
163163
The return value i is such that all e in a[:i] have e <= x, and all e in
164-
a[i:] have e > x. So if x already appears in the list, a.insert(i, x) will
165-
insert just after the rightmost x already there.
164+
a[i:] have e > x. So if x already appears in the list, a.insert(i, x)
165+
will insert just after the rightmost x already there.
166166
167167
Optional args lo (default 0) and hi (default len(a)) bound the
168168
slice of a to be searched.
@@ -173,7 +173,7 @@ A custom key function can be supplied to customize the sort order.
173173
static Py_ssize_t
174174
_bisect_bisect_right_impl(PyObject *module, PyObject *a, PyObject *x,
175175
Py_ssize_t lo, Py_ssize_t hi, PyObject *key)
176-
/*[clinic end generated code: output=3a4bc09cc7c8a73d input=43071869772dd53a]*/
176+
/*[clinic end generated code: output=3a4bc09cc7c8a73d input=b8951a7bb11516e1]*/
177177
{
178178
return internal_bisect_right(a, x, lo, hi, key);
179179
}
@@ -346,8 +346,8 @@ _bisect.bisect_left -> Py_ssize_t
346346
Return the index where to insert item x in list a, assuming a is sorted.
347347
348348
The return value i is such that all e in a[:i] have e < x, and all e in
349-
a[i:] have e >= x. So if x already appears in the list, a.insert(i, x) will
350-
insert just before the leftmost x already there.
349+
a[i:] have e >= x. So if x already appears in the list, a.insert(i, x)
350+
will insert just before the leftmost x already there.
351351
352352
Optional args lo (default 0) and hi (default len(a)) bound the
353353
slice of a to be searched.
@@ -358,7 +358,7 @@ A custom key function can be supplied to customize the sort order.
358358
static Py_ssize_t
359359
_bisect_bisect_left_impl(PyObject *module, PyObject *a, PyObject *x,
360360
Py_ssize_t lo, Py_ssize_t hi, PyObject *key)
361-
/*[clinic end generated code: output=70749d6e5cae9284 input=f29c4fe7f9b797c7]*/
361+
/*[clinic end generated code: output=70749d6e5cae9284 input=d24dc2b6439000f7]*/
362362
{
363363
return internal_bisect_left(a, x, lo, hi, key);
364364
}

Modules/_bz2module.c

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -606,24 +606,25 @@ _bz2.BZ2Decompressor.decompress
606606
607607
Decompress *data*, returning uncompressed data as bytes.
608608
609-
If *max_length* is nonnegative, returns at most *max_length* bytes of
610-
decompressed data. If this limit is reached and further output can be
611-
produced, *self.needs_input* will be set to ``False``. In this case, the next
612-
call to *decompress()* may provide *data* as b'' to obtain more of the output.
613-
614-
If all of the input data was decompressed and returned (either because this
615-
was less than *max_length* bytes, or because *max_length* was negative),
616-
*self.needs_input* will be set to True.
617-
618-
Attempting to decompress data after the end of stream is reached raises an
619-
EOFError. Any data found after the end of the stream is ignored and saved in
620-
the unused_data attribute.
609+
If *max_length* is nonnegative, returns at most *max_length* bytes
610+
of decompressed data. If this limit is reached and further output
611+
can be produced, *self.needs_input* will be set to ``False``. In
612+
this case, the next call to *decompress()* may provide *data* as b''
613+
to obtain more of the output.
614+
615+
If all of the input data was decompressed and returned (either
616+
because this was less than *max_length* bytes, or because
617+
*max_length* was negative), *self.needs_input* will be set to True.
618+
619+
Attempting to decompress data after the end of stream is reached
620+
raises an EOFError. Any data found after the end of the stream is
621+
ignored and saved in the unused_data attribute.
621622
[clinic start generated code]*/
622623

623624
static PyObject *
624625
_bz2_BZ2Decompressor_decompress_impl(BZ2Decompressor *self, Py_buffer *data,
625626
Py_ssize_t max_length)
626-
/*[clinic end generated code: output=23e41045deb240a3 input=52e1ffc66a8ea624]*/
627+
/*[clinic end generated code: output=23e41045deb240a3 input=7f68faa9ff7a1b51]*/
627628
{
628629
PyObject *result = NULL;
629630

Modules/_codecsmodule.c

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,15 @@ _codecs.register
5555
5656
Register a codec search function.
5757
58-
Search functions are expected to take one argument, the encoding name in
59-
all lower case letters, and either return None, or a tuple of functions
60-
(encoder, decoder, stream_reader, stream_writer) (or a CodecInfo object).
58+
Search functions are expected to take one argument, the encoding
59+
name in all lower case letters, and either return None, or a tuple
60+
of functions (encoder, decoder, stream_reader, stream_writer) (or
61+
a CodecInfo object).
6162
[clinic start generated code]*/
6263

6364
static PyObject *
6465
_codecs_register(PyObject *module, PyObject *search_function)
65-
/*[clinic end generated code: output=d1bf21e99db7d6d3 input=369578467955cae4]*/
66+
/*[clinic end generated code: output=d1bf21e99db7d6d3 input=2321d8c8c0420dfc]*/
6667
{
6768
if (PyCodec_Register(search_function))
6869
return NULL;
@@ -115,16 +116,16 @@ _codecs.encode
115116
Encodes obj using the codec registered for encoding.
116117
117118
The default encoding is 'utf-8'. errors may be given to set a
118-
different error handling scheme. Default is 'strict' meaning that encoding
119-
errors raise a ValueError. Other possible values are 'ignore', 'replace'
120-
and 'backslashreplace' as well as any other name registered with
121-
codecs.register_error that can handle ValueErrors.
119+
different error handling scheme. Default is 'strict' meaning that
120+
encoding errors raise a ValueError. Other possible values are 'ignore',
121+
'replace' and 'backslashreplace' as well as any other name registered
122+
with codecs.register_error that can handle ValueErrors.
122123
[clinic start generated code]*/
123124

124125
static PyObject *
125126
_codecs_encode_impl(PyObject *module, PyObject *obj, const char *encoding,
126127
const char *errors)
127-
/*[clinic end generated code: output=385148eb9a067c86 input=cd5b685040ff61f0]*/
128+
/*[clinic end generated code: output=385148eb9a067c86 input=e5271d443e391d7f]*/
128129
{
129130
if (encoding == NULL)
130131
encoding = PyUnicode_GetDefaultEncoding();
@@ -142,16 +143,16 @@ _codecs.decode
142143
Decodes obj using the codec registered for encoding.
143144
144145
Default encoding is 'utf-8'. errors may be given to set a
145-
different error handling scheme. Default is 'strict' meaning that encoding
146-
errors raise a ValueError. Other possible values are 'ignore', 'replace'
147-
and 'backslashreplace' as well as any other name registered with
148-
codecs.register_error that can handle ValueErrors.
146+
different error handling scheme. Default is 'strict' meaning that
147+
encoding errors raise a ValueError. Other possible values are 'ignore',
148+
'replace' and 'backslashreplace' as well as any other name registered
149+
with codecs.register_error that can handle ValueErrors.
149150
[clinic start generated code]*/
150151

151152
static PyObject *
152153
_codecs_decode_impl(PyObject *module, PyObject *obj, const char *encoding,
153154
const char *errors)
154-
/*[clinic end generated code: output=679882417dc3a0bd input=7702c0cc2fa1add6]*/
155+
/*[clinic end generated code: output=679882417dc3a0bd input=3e6254628f9ca538]*/
155156
{
156157
if (encoding == NULL)
157158
encoding = PyUnicode_GetDefaultEncoding();
@@ -966,14 +967,15 @@ _codecs.register_error
966967
Register the specified error handler under the name errors.
967968
968969
handler must be a callable object, that will be called with an exception
969-
instance containing information about the location of the encoding/decoding
970-
error and must return a (replacement, new position) tuple.
970+
instance containing information about the location of the
971+
encoding/decoding error and must return a (replacement, new position)
972+
tuple.
971973
[clinic start generated code]*/
972974

973975
static PyObject *
974976
_codecs_register_error_impl(PyObject *module, const char *errors,
975977
PyObject *handler)
976-
/*[clinic end generated code: output=fa2f7d1879b3067d input=5e6709203c2e33fe]*/
978+
/*[clinic end generated code: output=fa2f7d1879b3067d input=5bea01dfe835d9d8]*/
977979
{
978980
if (PyCodec_RegisterError(errors, handler))
979981
return NULL;
@@ -1011,13 +1013,13 @@ _codecs.lookup_error
10111013
10121014
lookup_error(errors) -> handler
10131015
1014-
Return the error handler for the specified error handling name or raise a
1015-
LookupError, if no handler exists under this name.
1016+
Return the error handler for the specified error handling name or raise
1017+
a LookupError, if no handler exists under this name.
10161018
[clinic start generated code]*/
10171019

10181020
static PyObject *
10191021
_codecs_lookup_error_impl(PyObject *module, const char *name)
1020-
/*[clinic end generated code: output=087f05dc0c9a98cc input=4775dd65e6235aba]*/
1022+
/*[clinic end generated code: output=087f05dc0c9a98cc input=86cfb6a7a9c67113]*/
10211023
{
10221024
return PyCodec_LookupError(name);
10231025
}

Modules/_datetimemodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3302,13 +3302,13 @@ datetime.date.fromtimestamp
33023302
33033303
Create a date from a POSIX timestamp.
33043304
3305-
The timestamp is a number, e.g. created via time.time(), that is interpreted
3306-
as local time.
3305+
The timestamp is a number, e.g. created via time.time(), that is
3306+
interpreted as local time.
33073307
[clinic start generated code]*/
33083308

33093309
static PyObject *
33103310
datetime_date_fromtimestamp_impl(PyTypeObject *type, PyObject *timestamp)
3311-
/*[clinic end generated code: output=59def4e32c028fb6 input=eabb3fe7f40491fe]*/
3311+
/*[clinic end generated code: output=59def4e32c028fb6 input=15720eef43b169a1]*/
33123312
{
33133313
return date_fromtimestamp((PyObject *) type, timestamp);
33143314
}

Modules/_dbmmodule.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,13 +436,14 @@ _dbm.dbm.setdefault
436436
437437
Return the value for key if present, otherwise default.
438438
439-
If key is not in the database, it is inserted with default as the value.
439+
If key is not in the database, it is inserted with default as the
440+
value.
440441
[clinic start generated code]*/
441442

442443
static PyObject *
443444
_dbm_dbm_setdefault_impl(dbmobject *self, PyTypeObject *cls, const char *key,
444445
Py_ssize_t key_length, PyObject *default_value)
445-
/*[clinic end generated code: output=9c2f6ea6d0fb576c input=c01510ef7571e13b]*/
446+
/*[clinic end generated code: output=9c2f6ea6d0fb576c input=81224965c110f830]*/
446447
{
447448
datum dbm_key, val;
448449
Py_ssize_t tmp_size;

Modules/_functoolsmodule.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -979,9 +979,9 @@ _functools.reduce
979979
980980
Apply a function of two arguments cumulatively to the items of an iterable, from left to right.
981981
982-
This effectively reduces the iterable to a single value. If initial is present,
983-
it is placed before the items of the iterable in the calculation, and serves as
984-
a default when the iterable is empty.
982+
This effectively reduces the iterable to a single value. If initial is
983+
present, it is placed before the items of the iterable in the
984+
calculation, and serves as a default when the iterable is empty.
985985
986986
For example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5])
987987
calculates ((((1 + 2) + 3) + 4) + 5).
@@ -990,7 +990,7 @@ calculates ((((1 + 2) + 3) + 4) + 5).
990990
static PyObject *
991991
_functools_reduce_impl(PyObject *module, PyObject *func, PyObject *seq,
992992
PyObject *result)
993-
/*[clinic end generated code: output=30d898fe1267c79d input=1511e9a8c38581ac]*/
993+
/*[clinic end generated code: output=30d898fe1267c79d input=1e2c850f5229ff2a]*/
994994
{
995995
PyObject *args, *it;
996996

Modules/_gdbmmodule.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -525,14 +525,14 @@ _gdbm.gdbm.firstkey
525525
526526
Return the starting key for the traversal.
527527
528-
It's possible to loop over every key in the database using this method
529-
and the nextkey() method. The traversal is ordered by GDBM's internal
530-
hash values, and won't be sorted by the key values.
528+
It's possible to loop over every key in the database using this
529+
method and the nextkey() method. The traversal is ordered by GDBM's
530+
internal hash values, and won't be sorted by the key values.
531531
[clinic start generated code]*/
532532

533533
static PyObject *
534534
_gdbm_gdbm_firstkey_impl(gdbmobject *self, PyTypeObject *cls)
535-
/*[clinic end generated code: output=139275e9c8b60827 input=aad5a7c886c542f5]*/
535+
/*[clinic end generated code: output=139275e9c8b60827 input=ba40f0d81eae0f35]*/
536536
{
537537
PyObject *v;
538538
datum key;
@@ -561,8 +561,8 @@ _gdbm.gdbm.nextkey
561561
562562
Returns the key that follows key in the traversal.
563563
564-
The following code prints every key in the database db, without having
565-
to create a list in memory that contains them all:
564+
The following code prints every key in the database db, without
565+
having to create a list in memory that contains them all:
566566
567567
k = db.firstkey()
568568
while k is not None:
@@ -573,7 +573,7 @@ to create a list in memory that contains them all:
573573
static PyObject *
574574
_gdbm_gdbm_nextkey_impl(gdbmobject *self, PyTypeObject *cls, const char *key,
575575
Py_ssize_t key_length)
576-
/*[clinic end generated code: output=c81a69300ef41766 input=181f1130d5bfeb1e]*/
576+
/*[clinic end generated code: output=c81a69300ef41766 input=78293a913b02387e]*/
577577
{
578578
PyObject *v;
579579
datum dbm_key, nextkey;
@@ -604,14 +604,14 @@ Reorganize the database.
604604
605605
If you have carried out a lot of deletions and would like to shrink
606606
the space used by the GDBM file, this routine will reorganize the
607-
database. GDBM will not shorten the length of a database file except
608-
by using this reorganization; otherwise, deleted file space will be
609-
kept and reused as new (key,value) pairs are added.
607+
database. GDBM will not shorten the length of a database file
608+
except by using this reorganization; otherwise, deleted file space
609+
will be kept and reused as new (key,value) pairs are added.
610610
[clinic start generated code]*/
611611

612612
static PyObject *
613613
_gdbm_gdbm_reorganize_impl(gdbmobject *self, PyTypeObject *cls)
614-
/*[clinic end generated code: output=d77c69e8e3dd644a input=3e3ca0d2ea787861]*/
614+
/*[clinic end generated code: output=d77c69e8e3dd644a input=d7fcf03051c6f7cd]*/
615615
{
616616
_gdbm_state *state = PyType_GetModuleState(cls);
617617
assert(state != NULL);

0 commit comments

Comments
 (0)