Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Doc/library/contextvars.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,15 @@ Context Variables
# After the reset call the var has no value again, so
# var.get() would raise a LookupError.

The same *token* cannot be used twice.

Comment thread
johnslavik marked this conversation as resolved.

.. class:: Token

*Token* objects are returned by the :meth:`ContextVar.set` method.
They can be passed to the :meth:`ContextVar.reset` method to revert
the value of the variable to what it was before the corresponding
*set*.
*set*. A single token cannot reset a context variable more than once.

The token supports :ref:`context manager protocol <context-managers>`
Comment thread
johnslavik marked this conversation as resolved.
Outdated
to restore the corresponding context variable value at the exit from
Expand Down
Loading