From 61056e7a3a85f97fca8850629d0f104f291b9a99 Mon Sep 17 00:00:00 2001 From: Kadir Can Ozden <101993364+bysiber@users.noreply.github.com> Date: Fri, 20 Feb 2026 17:08:06 +0300 Subject: [PATCH] Fix unregister skipping cleanup for falsy plugin objects The condition `if self._name2plugin.get(name):` uses truthiness to decide whether to delete the name-to-plugin mapping. A plugin that evaluates as falsy (e.g. a container-like object with __len__ returning 0 or __bool__ returning False) will not be removed, leaving a stale entry that prevents re-registering. The comment says "if == None registration was blocked: ignore", confirming the intent is to skip only when the value is None. Using `is not None` matches this intent. --- src/pluggy/_manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pluggy/_manager.py b/src/pluggy/_manager.py index 1b994f25..604545cc 100644 --- a/src/pluggy/_manager.py +++ b/src/pluggy/_manager.py @@ -224,7 +224,7 @@ def unregister( hookcaller._remove_plugin(plugin) # if self._name2plugin[name] == None registration was blocked: ignore - if self._name2plugin.get(name): + if self._name2plugin.get(name) is not None: assert name is not None del self._name2plugin[name]