Skip to content

[flake8-bugbear] Ignore enum classes in cached-instance-method (B019)#11312

Merged
charliermarsh merged 1 commit intomainfrom
charlie/en
May 6, 2024
Merged

[flake8-bugbear] Ignore enum classes in cached-instance-method (B019)#11312
charliermarsh merged 1 commit intomainfrom
charlie/en

Conversation

@charliermarsh
Copy link
Copy Markdown
Member

@charliermarsh charliermarsh commented May 6, 2024

Summary

While I was here, I also updated the rule to use function_type::classify rather than hard-coding staticmethod and friends.

Per Carl:

Enum instances are already referred to by the class, forming a cycle that won't get collected until the class itself does. At which point the lru_cache itself would be collected, too.

Closes #9912.

@charliermarsh charliermarsh added the rule Implementing or modifying a lint rule label May 6, 2024
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented May 6, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@charliermarsh charliermarsh merged commit 12b5c3a into main May 6, 2024
@charliermarsh charliermarsh deleted the charlie/en branch May 6, 2024 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rule Implementing or modifying a lint rule

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cached-instance-method (B019) gives false positive when decorated method belongs to enum.Enum

1 participant