Skip to content

fix: reject PluginManager.register(None) - #731

Open
Pitchfork-and-Torch wants to merge 1 commit into
pytest-dev:mainfrom
Pitchfork-and-Torch:cook/reject-register-none
Open

Pitchfork-and-Torch wants to merge 1 commit into
pytest-dev:mainfrom
Pitchfork-and-Torch:cook/reject-register-none

Conversation

@Pitchfork-and-Torch

Copy link
Copy Markdown

Summary

None is the blocked-name sentinel in _name2plugin (set_blocked stores None). register(None) therefore silently behaved like set_blocked(str(id(None))):

  • is_blocked(name) became true
  • is_registered(None) became true
  • get_plugins() omitted it

Raise TypeError("plugin must not be None") instead.

Test plan

  • testing/test_pluginmanager.py::test_register_rejects_none passes

None is the blocked-name sentinel in _name2plugin. register(None) silently
acted like set_blocked(str(id(None))), making is_registered(None) true while
get_plugins() omitted it. Raise TypeError instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant