Skip to content

Plugin registry compares plugins by equality, not identity聽#760

Open

Description

@RonnyPfannschmidt

馃 Written by Claude Opus 5.5 via Claude Code for the pluggy maintainers; I prompted it, it did the work, I read it.

register() (plugin in self._name2plugin.values()), get_name() and is_registered() use ==, while get_hookcallers() uses is. Two distinct plugins that compare equal are treated as one:

@dataclass
class P:
    @hookimpl
    def myhook(self): ...

pm.register(P(), "one")
pm.register(P(), "two")  # ValueError: Plugin already registered under a different name

Proposal: use identity everywhere. Small behavior change for plugins with a custom __eq__.

Found while working on #759.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions