We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5ff81da commit 949fd5fCopy full SHA for 949fd5f
Doc/library/contextvars.rst
@@ -14,6 +14,12 @@ and work with *Context Variables*. The :func:`~contextvars.copy_context`
14
function and the :class:`~contextvars.Context` class should be used to
15
manage the current context in asynchronous frameworks.
16
17
+.. note::
18
+ By default, every thread will have a different default
19
+ :class:`~contextvars.Context`. This means that a
20
+ :class:`~contextvars.ContextVar` can generally be used as a drop-in
21
+ replacement for a :func:`threading.local` variable.
22
+
23
Context managers that have state should use Context Variables
24
instead of :func:`threading.local()` to prevent their state from
25
bleeding to other code unexpectedly, when used in concurrent code.
0 commit comments