Skip to content

Commit 287c98f

Browse files
gh-150285: Fix too long docstrings in Argument Clinic code (GH-150338)
1 parent 0563890 commit 287c98f

91 files changed

Lines changed: 768 additions & 702 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
@@ -915,14 +915,14 @@ _abc.get_cache_token
915915
916916
Returns the current ABC cache token.
917917
918-
The token is an opaque object (supporting equality testing) identifying the
919-
current version of the ABC cache for virtual subclasses. The token changes
920-
with every call to register() on any ABC.
918+
The token is an opaque object (supporting equality testing) identifying
919+
the current version of the ABC cache for virtual subclasses. The token
920+
changes with every call to register() on any ABC.
921921
[clinic start generated code]*/
922922

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

Modules/_asynciomodule.c

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -955,12 +955,13 @@ Return the result this future represents.
955955
956956
If the future has been cancelled, raises CancelledError. If the
957957
future's result isn't yet available, raises InvalidStateError. If
958-
the future is done and has an exception set, this exception is raised.
958+
the future is done and has an exception set, this exception is
959+
raised.
959960
[clinic start generated code]*/
960961

961962
static PyObject *
962963
_asyncio_Future_result_impl(FutureObj *self)
963-
/*[clinic end generated code: output=f35f940936a4b1e5 input=61d89f48e4c8b670]*/
964+
/*[clinic end generated code: output=f35f940936a4b1e5 input=ee20e126776cbb04]*/
964965
{
965966
asyncio_state *state = get_asyncio_state_by_def((PyObject *)self);
966967
PyObject *result;
@@ -1095,15 +1096,15 @@ _asyncio.Future.add_done_callback
10951096
10961097
Add a callback to be run when the future becomes done.
10971098
1098-
The callback is called with a single argument - the future object. If
1099-
the future is already done when this is called, the callback is
1099+
The callback is called with a single argument - the future object.
1100+
If the future is already done when this is called, the callback is
11001101
scheduled with call_soon.
11011102
[clinic start generated code]*/
11021103

11031104
static PyObject *
11041105
_asyncio_Future_add_done_callback_impl(FutureObj *self, PyTypeObject *cls,
11051106
PyObject *fn, PyObject *context)
1106-
/*[clinic end generated code: output=922e9a4cbd601167 input=37d97f941beb7b3e]*/
1107+
/*[clinic end generated code: output=922e9a4cbd601167 input=f4f6adb074cd3e0f]*/
11071108
{
11081109
asyncio_state *state = get_asyncio_state_by_cls(cls);
11091110
if (context == NULL) {
@@ -1252,15 +1253,15 @@ _asyncio.Future.cancel
12521253
12531254
Cancel the future and schedule callbacks.
12541255
1255-
If the future is already done or cancelled, return False. Otherwise,
1256-
change the future's state to cancelled, schedule the callbacks and
1257-
return True.
1256+
If the future is already done or cancelled, return False.
1257+
Otherwise, change the future's state to cancelled, schedule the
1258+
callbacks and return True.
12581259
[clinic start generated code]*/
12591260

12601261
static PyObject *
12611262
_asyncio_Future_cancel_impl(FutureObj *self, PyTypeObject *cls,
12621263
PyObject *msg)
1263-
/*[clinic end generated code: output=074956f35904b034 input=44ab4003da839970]*/
1264+
/*[clinic end generated code: output=074956f35904b034 input=0c9157547a964c4c]*/
12641265
{
12651266
asyncio_state *state = get_asyncio_state_by_cls(cls);
12661267
ENSURE_FUTURE_ALIVE(state, self)
@@ -1292,13 +1293,13 @@ _asyncio.Future.done
12921293
12931294
Return True if the future is done.
12941295
1295-
Done means either that a result / exception are available, or that the
1296-
future was cancelled.
1296+
Done means either that a result / exception are available, or that
1297+
the future was cancelled.
12971298
[clinic start generated code]*/
12981299

12991300
static PyObject *
13001301
_asyncio_Future_done_impl(FutureObj *self)
1301-
/*[clinic end generated code: output=244c5ac351145096 input=7204d3cc63bef7f3]*/
1302+
/*[clinic end generated code: output=244c5ac351145096 input=acf2c2347f3c01d8]*/
13021303
{
13031304
if (!future_is_alive(self) || self->fut_state == STATE_PENDING) {
13041305
Py_RETURN_FALSE;
@@ -3844,6 +3845,7 @@ _asyncio__leave_task_impl(PyObject *module, PyObject *loop, PyObject *task)
38443845

38453846

38463847
/*[clinic input]
3848+
@permit_long_summary
38473849
_asyncio._swap_current_task
38483850
38493851
loop: object
@@ -3858,7 +3860,7 @@ This is intended for use during eager coroutine execution.
38583860
static PyObject *
38593861
_asyncio__swap_current_task_impl(PyObject *module, PyObject *loop,
38603862
PyObject *task)
3861-
/*[clinic end generated code: output=9f88de958df74c7e input=c9c72208d3d38b6c]*/
3863+
/*[clinic end generated code: output=9f88de958df74c7e input=ec14ed25855e3068]*/
38623864
{
38633865
_PyThreadStateImpl *ts = (_PyThreadStateImpl *)_PyThreadState_GET();
38643866
return swap_current_task(ts, loop, task);

Modules/_bisectmodule.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ _bisect.bisect_right -> Py_ssize_t
157157
Return the index where to insert item x in list a, assuming a is sorted.
158158
159159
The return value i is such that all e in a[:i] have e <= x, and all e in
160-
a[i:] have e > x. So if x already appears in the list, a.insert(i, x) will
161-
insert just after the rightmost x already there.
160+
a[i:] have e > x. So if x already appears in the list, a.insert(i, x)
161+
will insert just after the rightmost x already there.
162162
163163
Optional args lo (default 0) and hi (default len(a)) bound the
164164
slice of a to be searched.
@@ -169,7 +169,7 @@ A custom key function can be supplied to customize the sort order.
169169
static Py_ssize_t
170170
_bisect_bisect_right_impl(PyObject *module, PyObject *a, PyObject *x,
171171
Py_ssize_t lo, Py_ssize_t hi, PyObject *key)
172-
/*[clinic end generated code: output=3a4bc09cc7c8a73d input=b476bc45667273ac]*/
172+
/*[clinic end generated code: output=3a4bc09cc7c8a73d input=27717afe1a61bfaa]*/
173173
{
174174
return internal_bisect_right(a, x, lo, hi, key);
175175
}
@@ -338,8 +338,8 @@ _bisect.bisect_left -> Py_ssize_t
338338
Return the index where to insert item x in list a, assuming a is sorted.
339339
340340
The return value i is such that all e in a[:i] have e < x, and all e in
341-
a[i:] have e >= x. So if x already appears in the list, a.insert(i, x) will
342-
insert just before the leftmost x already there.
341+
a[i:] have e >= x. So if x already appears in the list, a.insert(i, x)
342+
will insert just before the leftmost x already there.
343343
344344
Optional args lo (default 0) and hi (default len(a)) bound the
345345
slice of a to be searched.
@@ -350,7 +350,7 @@ A custom key function can be supplied to customize the sort order.
350350
static Py_ssize_t
351351
_bisect_bisect_left_impl(PyObject *module, PyObject *a, PyObject *x,
352352
Py_ssize_t lo, Py_ssize_t hi, PyObject *key)
353-
/*[clinic end generated code: output=70749d6e5cae9284 input=9b4d49b5ddecfad7]*/
353+
/*[clinic end generated code: output=70749d6e5cae9284 input=259fedbe35e882e1]*/
354354
{
355355
return internal_bisect_left(a, x, lo, hi, key);
356356
}

Modules/_bz2module.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -577,32 +577,32 @@ decompress(BZ2Decompressor *d, char *data, size_t len, Py_ssize_t max_length)
577577
}
578578

579579
/*[clinic input]
580-
@permit_long_docstring_body
581580
_bz2.BZ2Decompressor.decompress
582581
583582
data: Py_buffer
584583
max_length: Py_ssize_t=-1
585584
586585
Decompress *data*, returning uncompressed data as bytes.
587586
588-
If *max_length* is nonnegative, returns at most *max_length* bytes of
589-
decompressed data. If this limit is reached and further output can be
590-
produced, *self.needs_input* will be set to ``False``. In this case, the next
591-
call to *decompress()* may provide *data* as b'' to obtain more of the output.
587+
If *max_length* is nonnegative, returns at most *max_length* bytes
588+
of decompressed data. If this limit is reached and further output
589+
can be produced, *self.needs_input* will be set to ``False``. In
590+
this case, the next call to *decompress()* may provide *data* as b''
591+
to obtain more of the output.
592592
593-
If all of the input data was decompressed and returned (either because this
594-
was less than *max_length* bytes, or because *max_length* was negative),
595-
*self.needs_input* will be set to True.
593+
If all of the input data was decompressed and returned (either
594+
because this was less than *max_length* bytes, or because
595+
*max_length* was negative), *self.needs_input* will be set to True.
596596
597-
Attempting to decompress data after the end of stream is reached raises an
598-
EOFError. Any data found after the end of the stream is ignored and saved in
599-
the unused_data attribute.
597+
Attempting to decompress data after the end of stream is reached
598+
raises an EOFError. Any data found after the end of the stream is
599+
ignored and saved in the unused_data attribute.
600600
[clinic start generated code]*/
601601

602602
static PyObject *
603603
_bz2_BZ2Decompressor_decompress_impl(BZ2Decompressor *self, Py_buffer *data,
604604
Py_ssize_t max_length)
605-
/*[clinic end generated code: output=23e41045deb240a3 input=3703e78f91757655]*/
605+
/*[clinic end generated code: output=23e41045deb240a3 input=7f68faa9ff7a1b51]*/
606606
{
607607
PyObject *result = NULL;
608608

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;
@@ -116,16 +117,16 @@ _codecs.encode
116117
Encodes obj using the codec registered for encoding.
117118
118119
The default encoding is 'utf-8'. errors may be given to set a
119-
different error handling scheme. Default is 'strict' meaning that encoding
120-
errors raise a ValueError. Other possible values are 'ignore', 'replace'
121-
and 'backslashreplace' as well as any other name registered with
122-
codecs.register_error that can handle ValueErrors.
120+
different error handling scheme. Default is 'strict' meaning that
121+
encoding errors raise a ValueError. Other possible values are 'ignore',
122+
'replace' and 'backslashreplace' as well as any other name registered
123+
with codecs.register_error that can handle ValueErrors.
123124
[clinic start generated code]*/
124125

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

152153
static PyObject *
153154
_codecs_decode_impl(PyObject *module, PyObject *obj, const char *encoding,
154155
const char *errors)
155-
/*[clinic end generated code: output=679882417dc3a0bd input=7702c0cc2fa1add6]*/
156+
/*[clinic end generated code: output=679882417dc3a0bd input=3e6254628f9ca538]*/
156157
{
157158
if (encoding == NULL)
158159
encoding = PyUnicode_GetDefaultEncoding();
@@ -962,14 +963,15 @@ _codecs.register_error
962963
Register the specified error handler under the name errors.
963964
964965
handler must be a callable object, that will be called with an exception
965-
instance containing information about the location of the encoding/decoding
966-
error and must return a (replacement, new position) tuple.
966+
instance containing information about the location of the
967+
encoding/decoding error and must return a (replacement, new position)
968+
tuple.
967969
[clinic start generated code]*/
968970

969971
static PyObject *
970972
_codecs_register_error_impl(PyObject *module, const char *errors,
971973
PyObject *handler)
972-
/*[clinic end generated code: output=fa2f7d1879b3067d input=5e6709203c2e33fe]*/
974+
/*[clinic end generated code: output=fa2f7d1879b3067d input=5bea01dfe835d9d8]*/
973975
{
974976
if (PyCodec_RegisterError(errors, handler))
975977
return NULL;
@@ -1007,13 +1009,13 @@ _codecs.lookup_error
10071009
10081010
lookup_error(errors) -> handler
10091011
1010-
Return the error handler for the specified error handling name or raise a
1011-
LookupError, if no handler exists under this name.
1012+
Return the error handler for the specified error handling name or raise
1013+
a LookupError, if no handler exists under this name.
10121014
[clinic start generated code]*/
10131015

10141016
static PyObject *
10151017
_codecs_lookup_error_impl(PyObject *module, const char *name)
1016-
/*[clinic end generated code: output=087f05dc0c9a98cc input=4775dd65e6235aba]*/
1018+
/*[clinic end generated code: output=087f05dc0c9a98cc input=86cfb6a7a9c67113]*/
10171019
{
10181020
return PyCodec_LookupError(name);
10191021
}

Modules/_collectionsmodule.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1077,6 +1077,7 @@ _deque_rotate(dequeobject *deque, Py_ssize_t n)
10771077
}
10781078

10791079
/*[clinic input]
1080+
@permit_long_summary
10801081
@critical_section
10811082
_collections.deque.rotate as deque_rotate
10821083
@@ -1089,7 +1090,7 @@ Rotate the deque n steps to the right. If n is negative, rotates left.
10891090

10901091
static PyObject *
10911092
deque_rotate_impl(dequeobject *deque, Py_ssize_t n)
1092-
/*[clinic end generated code: output=96c2402a371eb15d input=5bf834296246e002]*/
1093+
/*[clinic end generated code: output=96c2402a371eb15d input=3543c3b2297de8f1]*/
10931094
{
10941095
if (!_deque_rotate(deque, n))
10951096
Py_RETURN_NONE;

0 commit comments

Comments
 (0)