]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Clarify that every thread has its own default context in contextvars (#99246)
authorPablo Galindo Salgado <Pablogsal@gmail.com>
Tue, 20 Dec 2022 11:35:48 +0000 (11:35 +0000)
committerGitHub <noreply@github.com>
Tue, 20 Dec 2022 11:35:48 +0000 (11:35 +0000)
Doc/library/contextvars.rst

index 08a7c7d74eab97a5957f69260982e130a7a34a5d..0ac2f3d85749b7c48ae5f84dfe5bff39802215ef 100644 (file)
@@ -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)