gh-150285: Fix too long docstrings in Argument Clinic code (GH-150338)

This commit is contained in:
Serhiy Storchaka 2026-05-24 16:16:12 +03:00 committed by GitHub
parent 0563890872
commit 287c98f4cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
91 changed files with 768 additions and 702 deletions

View file

@ -618,6 +618,7 @@ context_tp_contains(PyObject *op, PyObject *key)
/*[clinic input]
@permit_long_summary
_contextvars.Context.get
key: object
default: object = None
@ -625,14 +626,14 @@ _contextvars.Context.get
Return the value for `key` if `key` has the value in the context object.
If `key` does not exist, return `default`. If `default` is not given,
return None.
If `key` does not exist, return `default`. If `default` is not
given, return None.
[clinic start generated code]*/
static PyObject *
_contextvars_Context_get_impl(PyContext *self, PyObject *key,
PyObject *default_value)
/*[clinic end generated code: output=0c54aa7664268189 input=c8eeb81505023995]*/
/*[clinic end generated code: output=0c54aa7664268189 input=d669a0d56fabb0a5]*/
{
if (context_check_key_type(key)) {
return NULL;
@ -1006,23 +1007,24 @@ contextvar_tp_repr(PyObject *op)
/*[clinic input]
@permit_long_docstring_body
_contextvars.ContextVar.get
default: object = NULL
/
Return a value for the context variable for the current context.
If there is no value for the variable in the current context, the method will:
* return the value of the default argument of the method, if provided; or
* return the default value for the context variable, if it was created
with one; or
If there is no value for the variable in the current context, the
method will:
* return the value of the default argument of the method, if
provided; or
* return the default value for the context variable, if it was
created with one; or
* raise a LookupError.
[clinic start generated code]*/
static PyObject *
_contextvars_ContextVar_get_impl(PyContextVar *self, PyObject *default_value)
/*[clinic end generated code: output=0746bd0aa2ced7bf input=da66664d5d0af4ad]*/
/*[clinic end generated code: output=0746bd0aa2ced7bf input=83814c6aef4a9fe3]*/
{
PyObject *val;
if (PyContextVar_Get((PyObject *)self, default_value, &val) < 0) {
@ -1038,41 +1040,41 @@ _contextvars_ContextVar_get_impl(PyContextVar *self, PyObject *default_value)
}
/*[clinic input]
@permit_long_docstring_body
@permit_long_summary
_contextvars.ContextVar.set
value: object
/
Call to set a new value for the context variable in the current context.
The required value argument is the new value for the context variable.
The required value argument is the new value for the context
variable.
Returns a Token object that can be used to restore the variable to its previous
value via the `ContextVar.reset()` method.
Returns a Token object that can be used to restore the variable to
its previous value via the `ContextVar.reset()` method.
[clinic start generated code]*/
static PyObject *
_contextvars_ContextVar_set_impl(PyContextVar *self, PyObject *value)
/*[clinic end generated code: output=1b562d35cc79c806 input=73ebbbfc7c98f6cd]*/
/*[clinic end generated code: output=1b562d35cc79c806 input=04ef8dcd810f5be6]*/
{
return PyContextVar_Set((PyObject *)self, value);
}
/*[clinic input]
@permit_long_docstring_body
_contextvars.ContextVar.reset
token: object
/
Reset the context variable.
The variable is reset to the value it had before the `ContextVar.set()` that
created the token was used.
The variable is reset to the value it had before the
`ContextVar.set()` that created the token was used.
[clinic start generated code]*/
static PyObject *
_contextvars_ContextVar_reset_impl(PyContextVar *self, PyObject *token)
/*[clinic end generated code: output=3205d2bdff568521 input=b8bc514a9245242a]*/
/*[clinic end generated code: output=3205d2bdff568521 input=dd33cfcb18c00e37]*/
{
if (!PyContextToken_CheckExact(token)) {
PyErr_Format(PyExc_TypeError,