Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Improve ContextVar in closures documentation #131837

Open
Labels
docsDocumentation in the Doc dir
@lysnikolaou

Description

@lysnikolaou

Documentation

In the [documentation forcontextvars.ContextVar], there is the following warning:

Important: Context Variables should be created at the top module level and never in closures.Context objects hold strong references to context variables which prevents context variables from being properly garbage collected.

@kumaraditya303 and I talked about it and he claimed that this is not the case any more (that was at least my understanding) andContextVars can be defined as class/instance attributes for example. If that's the case, we should probably update the docs. Otherwise, it might make sense to emphasize on it even more, now thatContextVars will be even more widely used due to free-threading.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp