mirror of
https://github.com/python/cpython.git
synced 2026-06-19 08:02:29 +00:00
[3.14] gh-150285: Fix too long docstrings in Argument Clinic code (GH-150338) (GH-150350) (GH-150473)
(cherry picked from commitcf73b17adf) (cherry picked from commit287c98f4cb)
This commit is contained in:
parent
26c5468b5d
commit
49975a511f
71 changed files with 586 additions and 531 deletions
27
Python/clinic/context.c.h
generated
27
Python/clinic/context.c.h
generated
|
|
@ -10,8 +10,8 @@ PyDoc_STRVAR(_contextvars_Context_get__doc__,
|
|||
"\n"
|
||||
"Return the value for `key` if `key` has the value in the context object.\n"
|
||||
"\n"
|
||||
"If `key` does not exist, return `default`. If `default` is not given,\n"
|
||||
"return None.");
|
||||
"If `key` does not exist, return `default`. If `default` is not\n"
|
||||
"given, return None.");
|
||||
|
||||
#define _CONTEXTVARS_CONTEXT_GET_METHODDEF \
|
||||
{"get", _PyCFunction_CAST(_contextvars_Context_get), METH_FASTCALL, _contextvars_Context_get__doc__},
|
||||
|
|
@ -122,10 +122,12 @@ PyDoc_STRVAR(_contextvars_ContextVar_get__doc__,
|
|||
"\n"
|
||||
"Return a value for the context variable for the current context.\n"
|
||||
"\n"
|
||||
"If there is no value for the variable in the current context, the method will:\n"
|
||||
" * return the value of the default argument of the method, if provided; or\n"
|
||||
" * return the default value for the context variable, if it was created\n"
|
||||
" with one; or\n"
|
||||
"If there is no value for the variable in the current context, the\n"
|
||||
"method will:\n"
|
||||
" * return the value of the default argument of the method, if\n"
|
||||
" provided; or\n"
|
||||
" * return the default value for the context variable, if it was\n"
|
||||
" created with one; or\n"
|
||||
" * raise a LookupError.");
|
||||
|
||||
#define _CONTEXTVARS_CONTEXTVAR_GET_METHODDEF \
|
||||
|
|
@ -160,10 +162,11 @@ PyDoc_STRVAR(_contextvars_ContextVar_set__doc__,
|
|||
"\n"
|
||||
"Call to set a new value for the context variable in the current context.\n"
|
||||
"\n"
|
||||
"The required value argument is the new value for the context variable.\n"
|
||||
"The required value argument is the new value for the context\n"
|
||||
"variable.\n"
|
||||
"\n"
|
||||
"Returns a Token object that can be used to restore the variable to its previous\n"
|
||||
"value via the `ContextVar.reset()` method.");
|
||||
"Returns a Token object that can be used to restore the variable to\n"
|
||||
"its previous value via the `ContextVar.reset()` method.");
|
||||
|
||||
#define _CONTEXTVARS_CONTEXTVAR_SET_METHODDEF \
|
||||
{"set", (PyCFunction)_contextvars_ContextVar_set, METH_O, _contextvars_ContextVar_set__doc__},
|
||||
|
|
@ -187,8 +190,8 @@ PyDoc_STRVAR(_contextvars_ContextVar_reset__doc__,
|
|||
"\n"
|
||||
"Reset the context variable.\n"
|
||||
"\n"
|
||||
"The variable is reset to the value it had before the `ContextVar.set()` that\n"
|
||||
"created the token was used.");
|
||||
"The variable is reset to the value it had before the\n"
|
||||
"`ContextVar.set()` that created the token was used.");
|
||||
|
||||
#define _CONTEXTVARS_CONTEXTVAR_RESET_METHODDEF \
|
||||
{"reset", (PyCFunction)_contextvars_ContextVar_reset, METH_O, _contextvars_ContextVar_reset__doc__},
|
||||
|
|
@ -256,4 +259,4 @@ token_exit(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=3a04b2fddf24c3e9 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=90ec3e4375804e9b input=a9049054013a1b77]*/
|
||||
|
|
|
|||
7
Python/clinic/import.c.h
generated
7
Python/clinic/import.c.h
generated
|
|
@ -34,8 +34,9 @@ PyDoc_STRVAR(_imp_acquire_lock__doc__,
|
|||
"\n"
|
||||
"Acquires the interpreter\'s import lock for the current thread.\n"
|
||||
"\n"
|
||||
"This lock should be used by import hooks to ensure thread-safety when importing\n"
|
||||
"modules. On platforms without threads, this function does nothing.");
|
||||
"This lock should be used by import hooks to ensure thread-safety when\n"
|
||||
"importing modules. On platforms without threads, this function does\n"
|
||||
"nothing.");
|
||||
|
||||
#define _IMP_ACQUIRE_LOCK_METHODDEF \
|
||||
{"acquire_lock", (PyCFunction)_imp_acquire_lock, METH_NOARGS, _imp_acquire_lock__doc__},
|
||||
|
|
@ -629,4 +630,4 @@ exit:
|
|||
#ifndef _IMP_EXEC_DYNAMIC_METHODDEF
|
||||
#define _IMP_EXEC_DYNAMIC_METHODDEF
|
||||
#endif /* !defined(_IMP_EXEC_DYNAMIC_METHODDEF) */
|
||||
/*[clinic end generated code: output=24f597d6b0f3feed input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=394455063b83475b input=a9049054013a1b77]*/
|
||||
|
|
|
|||
10
Python/clinic/marshal.c.h
generated
10
Python/clinic/marshal.c.h
generated
|
|
@ -195,8 +195,8 @@ PyDoc_STRVAR(marshal_dumps__doc__,
|
|||
" allow_code\n"
|
||||
" Allow to write code objects.\n"
|
||||
"\n"
|
||||
"Raise a ValueError exception if value has (or contains an object that has) an\n"
|
||||
"unsupported type.");
|
||||
"Raise a ValueError exception if value has (or contains an object that\n"
|
||||
"has) an unsupported type.");
|
||||
|
||||
#define MARSHAL_DUMPS_METHODDEF \
|
||||
{"dumps", _PyCFunction_CAST(marshal_dumps), METH_FASTCALL|METH_KEYWORDS, marshal_dumps__doc__},
|
||||
|
|
@ -280,8 +280,8 @@ PyDoc_STRVAR(marshal_loads__doc__,
|
|||
" allow_code\n"
|
||||
" Allow to load code objects.\n"
|
||||
"\n"
|
||||
"If no valid value is found, raise EOFError, ValueError or TypeError. Extra\n"
|
||||
"bytes in the input are ignored.");
|
||||
"If no valid value is found, raise EOFError, ValueError or TypeError.\n"
|
||||
"Extra bytes in the input are ignored.");
|
||||
|
||||
#define MARSHAL_LOADS_METHODDEF \
|
||||
{"loads", _PyCFunction_CAST(marshal_loads), METH_FASTCALL|METH_KEYWORDS, marshal_loads__doc__},
|
||||
|
|
@ -351,4 +351,4 @@ exit:
|
|||
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=3e4bfc070a3c78ac input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=a574570c3717f60e input=a9049054013a1b77]*/
|
||||
|
|
|
|||
23
Python/clinic/sysmodule.c.h
generated
23
Python/clinic/sysmodule.c.h
generated
|
|
@ -1396,7 +1396,8 @@ PyDoc_STRVAR(sys__stats_dump__doc__,
|
|||
"\n"
|
||||
"Dump stats to file, and clears the stats.\n"
|
||||
"\n"
|
||||
"Return False if no statistics were not dumped because stats gathering was off.");
|
||||
"Return False if no statistics were not dumped because stats gathering\n"
|
||||
"was off.");
|
||||
|
||||
#define SYS__STATS_DUMP_METHODDEF \
|
||||
{"_stats_dump", (PyCFunction)sys__stats_dump, METH_NOARGS, sys__stats_dump__doc__},
|
||||
|
|
@ -1544,16 +1545,16 @@ PyDoc_STRVAR(sys_remote_exec__doc__,
|
|||
"Executes a file containing Python code in a given remote Python process.\n"
|
||||
"\n"
|
||||
"This function returns immediately, and the code will be executed by the\n"
|
||||
"target process\'s main thread at the next available opportunity, similarly\n"
|
||||
"to how signals are handled. There is no interface to determine when the\n"
|
||||
"code has been executed. The caller is responsible for making sure that\n"
|
||||
"the file still exists whenever the remote process tries to read it and that\n"
|
||||
"it hasn\'t been overwritten.\n"
|
||||
"target process\'s main thread at the next available opportunity,\n"
|
||||
"similarly to how signals are handled. There is no interface to\n"
|
||||
"determine when the code has been executed. The caller is responsible\n"
|
||||
"for making sure that the file still exists whenever the remote process\n"
|
||||
"tries to read it and that it hasn\'t been overwritten.\n"
|
||||
"\n"
|
||||
"The remote process must be running a CPython interpreter of the same major\n"
|
||||
"and minor version as the local process. If either the local or remote\n"
|
||||
"interpreter is pre-release (alpha, beta, or release candidate) then the\n"
|
||||
"local and remote interpreters must be the same exact version.\n"
|
||||
"The remote process must be running a CPython interpreter of the same\n"
|
||||
"major and minor version as the local process. If either the local or\n"
|
||||
"remote interpreter is pre-release (alpha, beta, or release candidate)\n"
|
||||
"then the local and remote interpreters must be the same exact version.\n"
|
||||
"\n"
|
||||
"Args:\n"
|
||||
" pid (int): The process ID of the target Python process.\n"
|
||||
|
|
@ -1979,4 +1980,4 @@ exit:
|
|||
#ifndef SYS_GETANDROIDAPILEVEL_METHODDEF
|
||||
#define SYS_GETANDROIDAPILEVEL_METHODDEF
|
||||
#endif /* !defined(SYS_GETANDROIDAPILEVEL_METHODDEF) */
|
||||
/*[clinic end generated code: output=9052f399f40ca32d input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=407915aef6734c56 input=a9049054013a1b77]*/
|
||||
|
|
|
|||
|
|
@ -620,14 +620,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=d1be897231334ea9]*/
|
||||
{
|
||||
if (context_check_key_type(key)) {
|
||||
return NULL;
|
||||
|
|
@ -1007,16 +1007,18 @@ _contextvars.ContextVar.get
|
|||
|
||||
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=30aa2ab9e433e401]*/
|
||||
/*[clinic end generated code: output=0746bd0aa2ced7bf input=83814c6aef4a9fe3]*/
|
||||
{
|
||||
PyObject *val;
|
||||
if (PyContextVar_Get((PyObject *)self, default_value, &val) < 0) {
|
||||
|
|
@ -1038,15 +1040,16 @@ _contextvars.ContextVar.set
|
|||
|
||||
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=c0a6887154227453]*/
|
||||
/*[clinic end generated code: output=1b562d35cc79c806 input=6ffee66796d67896]*/
|
||||
{
|
||||
return PyContextVar_Set((PyObject *)self, value);
|
||||
}
|
||||
|
|
@ -1058,13 +1061,13 @@ _contextvars.ContextVar.reset
|
|||
|
||||
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=ebe2881e5af4ffda]*/
|
||||
/*[clinic end generated code: output=3205d2bdff568521 input=dd33cfcb18c00e37]*/
|
||||
{
|
||||
if (!PyContextToken_CheckExact(token)) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
|
|
|
|||
|
|
@ -4328,13 +4328,14 @@ _imp.acquire_lock
|
|||
|
||||
Acquires the interpreter's import lock for the current thread.
|
||||
|
||||
This lock should be used by import hooks to ensure thread-safety when importing
|
||||
modules. On platforms without threads, this function does nothing.
|
||||
This lock should be used by import hooks to ensure thread-safety when
|
||||
importing modules. On platforms without threads, this function does
|
||||
nothing.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
_imp_acquire_lock_impl(PyObject *module)
|
||||
/*[clinic end generated code: output=1aff58cb0ee1b026 input=4a2d4381866d5fdc]*/
|
||||
/*[clinic end generated code: output=1aff58cb0ee1b026 input=60e9c1b4ab471ead]*/
|
||||
{
|
||||
PyInterpreterState *interp = _PyInterpreterState_GET();
|
||||
_PyImport_AcquireLock(interp);
|
||||
|
|
|
|||
|
|
@ -2045,14 +2045,14 @@ marshal.dumps
|
|||
|
||||
Return the bytes object that would be written to a file by dump(value, file).
|
||||
|
||||
Raise a ValueError exception if value has (or contains an object that has) an
|
||||
unsupported type.
|
||||
Raise a ValueError exception if value has (or contains an object that
|
||||
has) an unsupported type.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
marshal_dumps_impl(PyObject *module, PyObject *value, int version,
|
||||
int allow_code)
|
||||
/*[clinic end generated code: output=115f90da518d1d49 input=167eaecceb63f0a8]*/
|
||||
/*[clinic end generated code: output=115f90da518d1d49 input=d9609c4dee4507fb]*/
|
||||
{
|
||||
return _PyMarshal_WriteObjectToString(value, version, allow_code);
|
||||
}
|
||||
|
|
@ -2068,13 +2068,13 @@ marshal.loads
|
|||
|
||||
Convert the bytes-like object to a value.
|
||||
|
||||
If no valid value is found, raise EOFError, ValueError or TypeError. Extra
|
||||
bytes in the input are ignored.
|
||||
If no valid value is found, raise EOFError, ValueError or TypeError.
|
||||
Extra bytes in the input are ignored.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
marshal_loads_impl(PyObject *module, Py_buffer *bytes, int allow_code)
|
||||
/*[clinic end generated code: output=62c0c538d3edc31f input=14de68965b45aaa7]*/
|
||||
/*[clinic end generated code: output=62c0c538d3edc31f input=286f1dbd6811d2ad]*/
|
||||
{
|
||||
RFILE rf;
|
||||
char *s = bytes->buf;
|
||||
|
|
|
|||
|
|
@ -2314,12 +2314,13 @@ sys._stats_dump -> bool
|
|||
|
||||
Dump stats to file, and clears the stats.
|
||||
|
||||
Return False if no statistics were not dumped because stats gathering was off.
|
||||
Return False if no statistics were not dumped because stats gathering
|
||||
was off.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static int
|
||||
sys__stats_dump_impl(PyObject *module)
|
||||
/*[clinic end generated code: output=6e346b4ba0de4489 input=31a489e39418b2a5]*/
|
||||
/*[clinic end generated code: output=6e346b4ba0de4489 input=7f3b7758cb59d2ff]*/
|
||||
{
|
||||
int res = _Py_PrintSpecializationStats(1);
|
||||
_Py_StatsClear();
|
||||
|
|
@ -2463,16 +2464,16 @@ sys.remote_exec
|
|||
Executes a file containing Python code in a given remote Python process.
|
||||
|
||||
This function returns immediately, and the code will be executed by the
|
||||
target process's main thread at the next available opportunity, similarly
|
||||
to how signals are handled. There is no interface to determine when the
|
||||
code has been executed. The caller is responsible for making sure that
|
||||
the file still exists whenever the remote process tries to read it and that
|
||||
it hasn't been overwritten.
|
||||
target process's main thread at the next available opportunity,
|
||||
similarly to how signals are handled. There is no interface to
|
||||
determine when the code has been executed. The caller is responsible
|
||||
for making sure that the file still exists whenever the remote process
|
||||
tries to read it and that it hasn't been overwritten.
|
||||
|
||||
The remote process must be running a CPython interpreter of the same major
|
||||
and minor version as the local process. If either the local or remote
|
||||
interpreter is pre-release (alpha, beta, or release candidate) then the
|
||||
local and remote interpreters must be the same exact version.
|
||||
The remote process must be running a CPython interpreter of the same
|
||||
major and minor version as the local process. If either the local or
|
||||
remote interpreter is pre-release (alpha, beta, or release candidate)
|
||||
then the local and remote interpreters must be the same exact version.
|
||||
|
||||
Args:
|
||||
pid (int): The process ID of the target Python process.
|
||||
|
|
@ -2482,7 +2483,7 @@ local and remote interpreters must be the same exact version.
|
|||
|
||||
static PyObject *
|
||||
sys_remote_exec_impl(PyObject *module, int pid, PyObject *script)
|
||||
/*[clinic end generated code: output=7d94c56afe4a52c0 input=39908ca2c5fe1eb0]*/
|
||||
/*[clinic end generated code: output=7d94c56afe4a52c0 input=7bd58f8da20cb74c]*/
|
||||
{
|
||||
PyObject *path;
|
||||
const char *debugger_script_path;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue