From 36f67c2a0bc81aaa0051b89073a7f2bd18e445ef Mon Sep 17 00:00:00 2001 From: Pablo Galindo Salgado Date: Tue, 20 Dec 2022 11:35:48 +0000 Subject: [PATCH] Clarify that every thread has its own default context in contextvars (GH-99246) (cherry picked from commit cb60b6131bc2bb11c48a15f808914d8b242b9fc5) Co-authored-by: Pablo Galindo Salgado --- Doc/library/contextvars.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Doc/library/contextvars.rst b/Doc/library/contextvars.rst index be1dd0c9eb57e8..3580b353734808 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)