Skip to content

Commit 6884051

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

65 files changed

Lines changed: 551 additions & 496 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
@@ -907,14 +907,14 @@ _abc.get_cache_token
907907
908908
Returns the current ABC cache token.
909909
910-
The token is an opaque object (supporting equality testing) identifying the
911-
current version of the ABC cache for virtual subclasses. The token changes
912-
with every call to register() on any ABC.
910+
The token is an opaque object (supporting equality testing) identifying
911+
the current version of the ABC cache for virtual subclasses. The token
912+
changes with every call to register() on any ABC.
913913
[clinic start generated code]*/
914914

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

Modules/_asynciomodule.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -781,12 +781,13 @@ Return the result this future represents.
781781
782782
If the future has been cancelled, raises CancelledError. If the
783783
future's result isn't yet available, raises InvalidStateError. If
784-
the future is done and has an exception set, this exception is raised.
784+
the future is done and has an exception set, this exception is
785+
raised.
785786
[clinic start generated code]*/
786787

787788
static PyObject *
788789
_asyncio_Future_result_impl(FutureObj *self)
789-
/*[clinic end generated code: output=f35f940936a4b1e5 input=49ecf9cf5ec50dc5]*/
790+
/*[clinic end generated code: output=f35f940936a4b1e5 input=c7361d75834bb8cd]*/
790791
{
791792
asyncio_state *state = get_asyncio_state_by_def((PyObject *)self);
792793
PyObject *result;
@@ -917,15 +918,15 @@ _asyncio.Future.add_done_callback
917918
918919
Add a callback to be run when the future becomes done.
919920
920-
The callback is called with a single argument - the future object. If
921-
the future is already done when this is called, the callback is
921+
The callback is called with a single argument - the future object.
922+
If the future is already done when this is called, the callback is
922923
scheduled with call_soon.
923924
[clinic start generated code]*/
924925

925926
static PyObject *
926927
_asyncio_Future_add_done_callback_impl(FutureObj *self, PyTypeObject *cls,
927928
PyObject *fn, PyObject *context)
928-
/*[clinic end generated code: output=922e9a4cbd601167 input=599261c521458cc2]*/
929+
/*[clinic end generated code: output=922e9a4cbd601167 input=1b96105434e0a562]*/
929930
{
930931
asyncio_state *state = get_asyncio_state_by_cls(cls);
931932
if (context == NULL) {
@@ -1072,15 +1073,15 @@ _asyncio.Future.cancel
10721073
10731074
Cancel the future and schedule callbacks.
10741075
1075-
If the future is already done or cancelled, return False. Otherwise,
1076-
change the future's state to cancelled, schedule the callbacks and
1077-
return True.
1076+
If the future is already done or cancelled, return False.
1077+
Otherwise, change the future's state to cancelled, schedule the
1078+
callbacks and return True.
10781079
[clinic start generated code]*/
10791080

10801081
static PyObject *
10811082
_asyncio_Future_cancel_impl(FutureObj *self, PyTypeObject *cls,
10821083
PyObject *msg)
1083-
/*[clinic end generated code: output=074956f35904b034 input=bba8f8b786941a94]*/
1084+
/*[clinic end generated code: output=074956f35904b034 input=4aefb2a5726ba0f5]*/
10841085
{
10851086
asyncio_state *state = get_asyncio_state_by_cls(cls);
10861087
ENSURE_FUTURE_ALIVE(state, self)
@@ -1110,13 +1111,13 @@ _asyncio.Future.done
11101111
11111112
Return True if the future is done.
11121113
1113-
Done means either that a result / exception are available, or that the
1114-
future was cancelled.
1114+
Done means either that a result / exception are available, or that
1115+
the future was cancelled.
11151116
[clinic start generated code]*/
11161117

11171118
static PyObject *
11181119
_asyncio_Future_done_impl(FutureObj *self)
1119-
/*[clinic end generated code: output=244c5ac351145096 input=28d7b23fdb65d2ac]*/
1120+
/*[clinic end generated code: output=244c5ac351145096 input=afad8c9d2283428d]*/
11201121
{
11211122
if (!future_is_alive(self) || self->fut_state == STATE_PENDING) {
11221123
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
@@ -602,24 +602,25 @@ _bz2.BZ2Decompressor.decompress
602602
603603
Decompress *data*, returning uncompressed data as bytes.
604604
605-
If *max_length* is nonnegative, returns at most *max_length* bytes of
606-
decompressed data. If this limit is reached and further output can be
607-
produced, *self.needs_input* will be set to ``False``. In this case, the next
608-
call to *decompress()* may provide *data* as b'' to obtain more of the output.
609-
610-
If all of the input data was decompressed and returned (either because this
611-
was less than *max_length* bytes, or because *max_length* was negative),
612-
*self.needs_input* will be set to True.
613-
614-
Attempting to decompress data after the end of stream is reached raises an
615-
EOFError. Any data found after the end of the stream is ignored and saved in
616-
the unused_data attribute.
605+
If *max_length* is nonnegative, returns at most *max_length* bytes
606+
of decompressed data. If this limit is reached and further output
607+
can be produced, *self.needs_input* will be set to ``False``. In
608+
this case, the next call to *decompress()* may provide *data* as b''
609+
to obtain more of the output.
610+
611+
If all of the input data was decompressed and returned (either
612+
because this was less than *max_length* bytes, or because
613+
*max_length* was negative), *self.needs_input* will be set to True.
614+
615+
Attempting to decompress data after the end of stream is reached
616+
raises an EOFError. Any data found after the end of the stream is
617+
ignored and saved in the unused_data attribute.
617618
[clinic start generated code]*/
618619

619620
static PyObject *
620621
_bz2_BZ2Decompressor_decompress_impl(BZ2Decompressor *self, Py_buffer *data,
621622
Py_ssize_t max_length)
622-
/*[clinic end generated code: output=23e41045deb240a3 input=52e1ffc66a8ea624]*/
623+
/*[clinic end generated code: output=23e41045deb240a3 input=7f68faa9ff7a1b51]*/
623624
{
624625
PyObject *result = NULL;
625626

Modules/_codecsmodule.c

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

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

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

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

972974
static PyObject *
973975
_codecs_register_error_impl(PyObject *module, const char *errors,
974976
PyObject *handler)
975-
/*[clinic end generated code: output=fa2f7d1879b3067d input=5e6709203c2e33fe]*/
977+
/*[clinic end generated code: output=fa2f7d1879b3067d input=5bea01dfe835d9d8]*/
976978
{
977979
if (PyCodec_RegisterError(errors, handler))
978980
return NULL;
@@ -986,13 +988,13 @@ _codecs.lookup_error
986988
987989
lookup_error(errors) -> handler
988990
989-
Return the error handler for the specified error handling name or raise a
990-
LookupError, if no handler exists under this name.
991+
Return the error handler for the specified error handling name or raise
992+
a LookupError, if no handler exists under this name.
991993
[clinic start generated code]*/
992994

993995
static PyObject *
994996
_codecs_lookup_error_impl(PyObject *module, const char *name)
995-
/*[clinic end generated code: output=087f05dc0c9a98cc input=4775dd65e6235aba]*/
997+
/*[clinic end generated code: output=087f05dc0c9a98cc input=86cfb6a7a9c67113]*/
996998
{
997999
return PyCodec_LookupError(name);
9981000
}

Modules/_datetimemodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3208,13 +3208,13 @@ datetime.date.fromtimestamp
32083208
32093209
Create a date from a POSIX timestamp.
32103210
3211-
The timestamp is a number, e.g. created via time.time(), that is interpreted
3212-
as local time.
3211+
The timestamp is a number, e.g. created via time.time(), that is
3212+
interpreted as local time.
32133213
[clinic start generated code]*/
32143214

32153215
static PyObject *
32163216
datetime_date_fromtimestamp(PyTypeObject *type, PyObject *timestamp)
3217-
/*[clinic end generated code: output=fd045fda58168869 input=eabb3fe7f40491fe]*/
3217+
/*[clinic end generated code: output=fd045fda58168869 input=15720eef43b169a1]*/
32183218
{
32193219
return date_fromtimestamp((PyObject *) type, timestamp);
32203220
}

Modules/_dbmmodule.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,13 +374,14 @@ _dbm.dbm.setdefault
374374
375375
Return the value for key if present, otherwise default.
376376
377-
If key is not in the database, it is inserted with default as the value.
377+
If key is not in the database, it is inserted with default as the
378+
value.
378379
[clinic start generated code]*/
379380

380381
static PyObject *
381382
_dbm_dbm_setdefault_impl(dbmobject *self, PyTypeObject *cls, const char *key,
382383
Py_ssize_t key_length, PyObject *default_value)
383-
/*[clinic end generated code: output=9c2f6ea6d0fb576c input=126a3ff15c5f8232]*/
384+
/*[clinic end generated code: output=9c2f6ea6d0fb576c input=87f3abca9f55f59d]*/
384385
{
385386
datum dbm_key, val;
386387
Py_ssize_t tmp_size;

Modules/_gdbmmodule.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -463,14 +463,14 @@ _gdbm.gdbm.firstkey
463463
464464
Return the starting key for the traversal.
465465
466-
It's possible to loop over every key in the database using this method
467-
and the nextkey() method. The traversal is ordered by GDBM's internal
468-
hash values, and won't be sorted by the key values.
466+
It's possible to loop over every key in the database using this
467+
method and the nextkey() method. The traversal is ordered by GDBM's
468+
internal hash values, and won't be sorted by the key values.
469469
[clinic start generated code]*/
470470

471471
static PyObject *
472472
_gdbm_gdbm_firstkey_impl(gdbmobject *self, PyTypeObject *cls)
473-
/*[clinic end generated code: output=139275e9c8b60827 input=ed8782a029a5d299]*/
473+
/*[clinic end generated code: output=139275e9c8b60827 input=27874d56cf39ac72]*/
474474
{
475475
PyObject *v;
476476
datum key;
@@ -498,8 +498,8 @@ _gdbm.gdbm.nextkey
498498
499499
Returns the key that follows key in the traversal.
500500
501-
The following code prints every key in the database db, without having
502-
to create a list in memory that contains them all:
501+
The following code prints every key in the database db, without
502+
having to create a list in memory that contains them all:
503503
504504
k = db.firstkey()
505505
while k is not None:
@@ -510,7 +510,7 @@ to create a list in memory that contains them all:
510510
static PyObject *
511511
_gdbm_gdbm_nextkey_impl(gdbmobject *self, PyTypeObject *cls, const char *key,
512512
Py_ssize_t key_length)
513-
/*[clinic end generated code: output=c81a69300ef41766 input=365e297bc0b3db48]*/
513+
/*[clinic end generated code: output=c81a69300ef41766 input=143ca0c63b442738]*/
514514
{
515515
PyObject *v;
516516
datum dbm_key, nextkey;
@@ -540,14 +540,14 @@ Reorganize the database.
540540
541541
If you have carried out a lot of deletions and would like to shrink
542542
the space used by the GDBM file, this routine will reorganize the
543-
database. GDBM will not shorten the length of a database file except
544-
by using this reorganization; otherwise, deleted file space will be
545-
kept and reused as new (key,value) pairs are added.
543+
database. GDBM will not shorten the length of a database file
544+
except by using this reorganization; otherwise, deleted file space
545+
will be kept and reused as new (key,value) pairs are added.
546546
[clinic start generated code]*/
547547

548548
static PyObject *
549549
_gdbm_gdbm_reorganize_impl(gdbmobject *self, PyTypeObject *cls)
550-
/*[clinic end generated code: output=d77c69e8e3dd644a input=e1359faeef844e46]*/
550+
/*[clinic end generated code: output=d77c69e8e3dd644a input=3efcec3838a4fdb6]*/
551551
{
552552
_gdbm_state *state = PyType_GetModuleState(cls);
553553
assert(state != NULL);

Modules/_hashopenssl.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,13 +1870,13 @@ _hashlib.HMAC.hexdigest
18701870
18711871
Return hexadecimal digest of the bytes passed to the update() method so far.
18721872
1873-
This may be used to exchange the value safely in email or other non-binary
1874-
environments.
1873+
This may be used to exchange the value safely in email or other
1874+
non-binary environments.
18751875
[clinic start generated code]*/
18761876

18771877
static PyObject *
18781878
_hashlib_HMAC_hexdigest_impl(HMACobject *self)
1879-
/*[clinic end generated code: output=80d825be1eaae6a7 input=5abc42702874ddcf]*/
1879+
/*[clinic end generated code: output=80d825be1eaae6a7 input=865e6128c7ec0781]*/
18801880
{
18811881
unsigned char digest[EVP_MAX_MD_SIZE];
18821882
unsigned int digest_size = _hashlib_hmac_digest_size(self);
@@ -2038,16 +2038,16 @@ _hashlib.get_fips_mode -> int
20382038
Determine the OpenSSL FIPS mode of operation.
20392039
20402040
For OpenSSL 3.0.0 and newer it returns the state of the default provider
2041-
in the default OSSL context. It's not quite the same as FIPS_mode() but good
2042-
enough for unittests.
2041+
in the default OSSL context. It's not quite the same as FIPS_mode() but
2042+
good enough for unittests.
20432043
20442044
Effectively any non-zero return value indicates FIPS mode;
20452045
values other than 1 may have additional significance.
20462046
[clinic start generated code]*/
20472047

20482048
static int
20492049
_hashlib_get_fips_mode_impl(PyObject *module)
2050-
/*[clinic end generated code: output=87eece1bab4d3fa9 input=2db61538c41c6fef]*/
2050+
/*[clinic end generated code: output=87eece1bab4d3fa9 input=a6cdb6901421d122]*/
20512051

20522052
{
20532053
#if OPENSSL_VERSION_NUMBER >= 0x30000000L

0 commit comments

Comments
 (0)