Skip to content

Fix UP008 nested class matching#24273

Merged
charliermarsh merged 1 commit intomainfrom
charlie/up
Mar 28, 2026
Merged

Fix UP008 nested class matching#24273
charliermarsh merged 1 commit intomainfrom
charlie/up

Conversation

@charliermarsh
Copy link
Copy Markdown
Member

Summary

UP008 (super-call-with-parameters) is triggering inside nested classes when the super() call references the inner class name, which is actually a NameError:

For example, this should not trigger, since Inner isn't a valid reference:

class Outer:
    class Inner(Base):
        def method(self):
            super(Inner, self).__init__()

Closes #24001.

@charliermarsh charliermarsh added the bug Something isn't working label Mar 28, 2026
@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot bot commented Mar 28, 2026

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@charliermarsh charliermarsh marked this pull request as ready for review March 28, 2026 18:53
@charliermarsh charliermarsh merged commit 09f645d into main Mar 28, 2026
42 checks passed
@astral-sh-bot astral-sh-bot bot requested a review from amyreese March 28, 2026 18:53
@charliermarsh charliermarsh deleted the charlie/up branch March 28, 2026 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UP008 false positive in nested class when the first super arg is not a full class path

2 participants