Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
May 6, 2024

Conversation

charliermarsh
Copy link
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
Copy link
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
19 checks passed
@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