summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-12-20 11:57:08 (GMT)
committerGitHub <noreply@github.com>2022-12-20 11:57:08 (GMT)
commite8f61ede93ecbda3b2055a2e1d8c0b43b2049737 (patch)
treece598d7dfbea6ab878e701eb9f2d9b9bde7f89ff
parentdb577e29a6a287dca0148e90bb95960c1d99b3fb (diff)
downloadcpython-e8f61ede93ecbda3b2055a2e1d8c0b43b2049737.zip
cpython-e8f61ede93ecbda3b2055a2e1d8c0b43b2049737.tar.gz
cpython-e8f61ede93ecbda3b2055a2e1d8c0b43b2049737.tar.bz2
Clarify that every thread has its own default context in contextvars (GH-99246)
(cherry picked from commit cb60b6131bc2bb11c48a15f808914d8b242b9fc5) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
-rw-r--r--Doc/library/contextvars.rst5
1 files changed, 5 insertions, 0 deletions
diff --git a/Doc/library/contextvars.rst b/Doc/library/contextvars.rst
index be1dd0c..3580b35 100644
--- a/Doc/library/contextvars.rst
+++ b/Doc/library/contextvars.rst
@@ -144,6 +144,11 @@ Manual Context Management
To get a copy of the current context use the
:func:`~contextvars.copy_context` function.
+ Every thread will have a different top-level :class:`~contextvars.Context`
+ object. This means that a :class:`ContextVar` object behaves in a similar
+ fashion to :func:`threading.local()` when values are assigned in different
+ threads.
+
Context implements the :class:`collections.abc.Mapping` interface.
.. method:: run(callable, *args, **kwargs)