Skip to content

Commit 440042f

Browse files
committed
Fix Context.items/keys/values docstrings (return iterators, not lists)
_contextvars.Context.items(), .keys(), and .values() return iterator objects, but their docstrings incorrectly claim they return lists. Signed-off-by: Yongtao Huang <yongtaoh2022@gmail.com>
1 parent 8b64dd8 commit 440042f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Python/context.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -650,12 +650,12 @@ _contextvars.Context.items
650650
651651
Return all variables and their values in the context object.
652652
653-
The result is returned as a list of 2-tuples (variable, value).
653+
The result is returned as an iterator of 2-tuples (variable, value).
654654
[clinic start generated code]*/
655655

656656
static PyObject *
657657
_contextvars_Context_items_impl(PyContext *self)
658-
/*[clinic end generated code: output=fa1655c8a08502af input=00db64ae379f9f42]*/
658+
/*[clinic end generated code: output=fa1655c8a08502af input=f9c1fe4d39962ea0]*/
659659
{
660660
return _PyHamt_NewIterItems(self->ctx_vars);
661661
}
@@ -664,12 +664,12 @@ _contextvars_Context_items_impl(PyContext *self)
664664
/*[clinic input]
665665
_contextvars.Context.keys
666666
667-
Return a list of all variables in the context object.
667+
Return an iterator of all variables in the context object.
668668
[clinic start generated code]*/
669669

670670
static PyObject *
671671
_contextvars_Context_keys_impl(PyContext *self)
672-
/*[clinic end generated code: output=177227c6b63ec0e2 input=114b53aebca3449c]*/
672+
/*[clinic end generated code: output=177227c6b63ec0e2 input=f806e4e5f77c7e7e]*/
673673
{
674674
return _PyHamt_NewIterKeys(self->ctx_vars);
675675
}
@@ -678,12 +678,12 @@ _contextvars_Context_keys_impl(PyContext *self)
678678
/*[clinic input]
679679
_contextvars.Context.values
680680
681-
Return a list of all variables' values in the context object.
681+
Return an iterator of all variables' values in the context object.
682682
[clinic start generated code]*/
683683

684684
static PyObject *
685685
_contextvars_Context_values_impl(PyContext *self)
686-
/*[clinic end generated code: output=d286dabfc8db6dde input=ce8075d04a6ea526]*/
686+
/*[clinic end generated code: output=d286dabfc8db6dde input=6f3cb30499d55021]*/
687687
{
688688
return _PyHamt_NewIterValues(self->ctx_vars);
689689
}

0 commit comments

Comments
 (0)