]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Clarify that every thread has its own default context in contextvars (GH-99246)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 20 Dec 2022 11:57:08 +0000 (03:57 -0800)
committerGitHub <noreply@github.com>
Tue, 20 Dec 2022 11:57:08 +0000 (03:57 -0800)
(cherry picked from commit cb60b6131bc2bb11c48a15f808914d8b242b9fc5)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Doc/library/contextvars.rst

index be1dd0c9eb57e8a8a4a9f4a60e8aebdf42d7baf9..3580b353734808023a5a3579b8e88c72f06b9abc 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)