Skip to content

Conversation

@danparizher
Copy link
Contributor

Summary

Fixes #20781

@github-actions
Copy link
Contributor

github-actions bot commented Oct 15, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Adds logic to identify classes with a metaclass-like __new__ method signature based on parameter count and type annotations. Updates is_metaclass to consider such signatures, improving detection of metaclasses that do not inherit from known metaclass bases.
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I pushed a few edits. The implementation LGTM now.

@ntBre, I think you mentioned on the issue that it might be good to document this heuristic? That does seem like it might be worthwhile. I'll punt this back to you now, if that's okay 😄

@AlexWaygood AlexWaygood requested a review from ntBre October 24, 2025 10:33
@ntBre ntBre added bug Something isn't working rule Implementing or modifying a lint rule labels Oct 24, 2025
@ntBre
Copy link
Contributor

ntBre commented Oct 24, 2025

Thanks @AlexWaygood, this looks great! And you did all the hard work, I basically just copied your docstring into the rule docs 😄

@AlexWaygood
Copy link
Member

Thanks @AlexWaygood, this looks great! And you did all the hard work, I basically just copied your docstring into the rule docs 😄

Ah I have to share credit with @danparizher for that docstring, he wrote half of it!!

@ntBre ntBre enabled auto-merge (squash) October 24, 2025 13:35
@ntBre ntBre merged commit 7576669 into astral-sh:main Oct 24, 2025
36 checks passed
@danparizher danparizher deleted the fix-20781 branch October 24, 2025 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working rule Implementing or modifying a lint rule

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PYI034 should not trigger on a metaclass

3 participants