Clarify that every thread has its own default context in contextvars (GH-99246)

(cherry picked from commit cb60b6131b)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
This commit is contained in:
Miss Islington (bot) 2022-12-20 03:44:55 -08:00 committed by GitHub
parent ba8e30c56b
commit 1332fdabba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View 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)