Skip to content

Move context manager usage of contextvars.Token to contextvars.ContextVar.set #142119

@johnslavik

Description

@johnslavik

Documentation

Follow-up to #129889.

The idea behind making contextvars.Token support context manager protocol was to eliminate the need for manipulating the token manually and instead use contextvars.ContextVar.set() directly. Therefore, it is more logical to present the context manager usage example in contextvars.ContextVar.set, not in contextvars.Token.

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.14bugs and security fixes3.15new features, bugs and security fixesdocsDocumentation in the Doc dir

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions