Skip to content

B039 considers frozenset to be mutable #14525

Closed
@layday

Description

@layday
$ cat foo.py 
from contextvars import ContextVar

foo = ContextVar('foo', default=frozenset[str]())
$ ruff check --select B039 foo.py
foo.py:3:33: B039 Do not use mutable data structures for `ContextVar` defaults
  |
1 | from contextvars import ContextVar
2 | 
3 | foo = ContextVar('foo', default=frozenset[str]())
  |                                 ^^^^^^^^^^^^^^^^ B039
  |
  = help: Replace with `None`; initialize with `.set()``

Found 1 error.
$ ruff --version                 
ruff 0.8.0

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions