From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 20 Dec 2022 11:44:55 +0000 (-0800) Subject: Clarify that every thread has its own default context in contextvars (GH-99246) X-Git-Tag: v3.11.2~164 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1332fdabbab75bc9e4bced064dc4daab2d7acb47;p=thirdparty%2FPython%2Fcpython.git Clarify that every thread has its own default context in contextvars (GH-99246) (cherry picked from commit cb60b6131bc2bb11c48a15f808914d8b242b9fc5) Co-authored-by: Pablo Galindo Salgado --- diff --git a/Doc/library/contextvars.rst b/Doc/library/contextvars.rst index 08a7c7d74eab..0ac2f3d85749 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)