This commit is contained in:
Yongtao Huang 2026-05-04 00:29:33 +00:00 committed by GitHub
commit a92a1d0b52
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 13 additions and 13 deletions

View file

@ -293,16 +293,16 @@ Manual Context Management
.. method:: keys()
Return a list of all variables in the context object.
Return an iterator of all variables in the context object.
.. method:: values()
Return a list of all variables' values in the context object.
Return an iterator of all variables' values in the context object.
.. method:: items()
Return a list of 2-tuples containing all variables and their
Return an iterator of 2-tuples containing all variables and their
values in the context object.

View file

@ -48,7 +48,7 @@ PyDoc_STRVAR(_contextvars_Context_items__doc__,
"\n"
"Return all variables and their values in the context object.\n"
"\n"
"The result is returned as a list of 2-tuples (variable, value).");
"The result is returned as an iterator of 2-tuples (variable, value).");
#define _CONTEXTVARS_CONTEXT_ITEMS_METHODDEF \
{"items", (PyCFunction)_contextvars_Context_items, METH_NOARGS, _contextvars_Context_items__doc__},
@ -66,7 +66,7 @@ PyDoc_STRVAR(_contextvars_Context_keys__doc__,
"keys($self, /)\n"
"--\n"
"\n"
"Return a list of all variables in the context object.");
"Return an iterator of all variables in the context object.");
#define _CONTEXTVARS_CONTEXT_KEYS_METHODDEF \
{"keys", (PyCFunction)_contextvars_Context_keys, METH_NOARGS, _contextvars_Context_keys__doc__},
@ -84,7 +84,7 @@ PyDoc_STRVAR(_contextvars_Context_values__doc__,
"values($self, /)\n"
"--\n"
"\n"
"Return a list of all variables\' values in the context object.");
"Return an iterator of all variables\' values in the context object.");
#define _CONTEXTVARS_CONTEXT_VALUES_METHODDEF \
{"values", (PyCFunction)_contextvars_Context_values, METH_NOARGS, _contextvars_Context_values__doc__},
@ -256,4 +256,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=a6b96499985059cd input=a9049054013a1b77]*/

View file

@ -655,12 +655,12 @@ _contextvars.Context.items
Return all variables and their values in the context object.
The result is returned as a list of 2-tuples (variable, value).
The result is returned as an iterator of 2-tuples (variable, value).
[clinic start generated code]*/
static PyObject *
_contextvars_Context_items_impl(PyContext *self)
/*[clinic end generated code: output=fa1655c8a08502af input=00db64ae379f9f42]*/
/*[clinic end generated code: output=fa1655c8a08502af input=f9c1fe4d39962ea0]*/
{
return _PyHamt_NewIterItems(self->ctx_vars);
}
@ -669,12 +669,12 @@ _contextvars_Context_items_impl(PyContext *self)
/*[clinic input]
_contextvars.Context.keys
Return a list of all variables in the context object.
Return an iterator of all variables in the context object.
[clinic start generated code]*/
static PyObject *
_contextvars_Context_keys_impl(PyContext *self)
/*[clinic end generated code: output=177227c6b63ec0e2 input=114b53aebca3449c]*/
/*[clinic end generated code: output=177227c6b63ec0e2 input=f806e4e5f77c7e7e]*/
{
return _PyHamt_NewIterKeys(self->ctx_vars);
}
@ -683,12 +683,12 @@ _contextvars_Context_keys_impl(PyContext *self)
/*[clinic input]
_contextvars.Context.values
Return a list of all variables' values in the context object.
Return an iterator of all variables' values in the context object.
[clinic start generated code]*/
static PyObject *
_contextvars_Context_values_impl(PyContext *self)
/*[clinic end generated code: output=d286dabfc8db6dde input=ce8075d04a6ea526]*/
/*[clinic end generated code: output=d286dabfc8db6dde input=6f3cb30499d55021]*/
{
return _PyHamt_NewIterValues(self->ctx_vars);
}