We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
contextvar.Token
1 parent aa8578d commit 0e18375Copy full SHA for 0e18375
Doc/library/contextvars.rst
@@ -93,13 +93,14 @@ Context Variables
93
# After the reset call the var has no value again, so
94
# var.get() would raise a LookupError.
95
96
+ The same *token* cannot be used twice.
97
98
.. class:: Token
99
100
*Token* objects are returned by the :meth:`ContextVar.set` method.
101
They can be passed to the :meth:`ContextVar.reset` method to revert
102
the value of the variable to what it was before the corresponding
- *set*.
103
+ *set*. A single token cannot reset a context variable more than once.
104
105
The token supports :ref:`context manager protocol <context-managers>`
106
to restore the corresponding context variable value at the exit from
0 commit comments