[bitbake-devel] [selftest][PATCH V2 3/3] bitbake: event: remove mapping for deleted event handlers

Jair Gonzalez jair.de.jesus.gonzalez.plascencia at linux.intel.com
Tue Feb 21 16:33:57 UTC 2017

The current remove method for class event handlers does not update the
event mapping after an event handler is deleted from the main dictionary.

This change enhances the remove method by also updating the event mapping

This was detected after creating the bb.tests.event module.

[YOCTO #10368]

Signed-off-by: Jair Gonzalez <jair.de.jesus.gonzalez.plascencia at linux.intel.com>
 bitbake/lib/bb/event.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index 6d8493b..e5b7447 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -264,6 +264,11 @@ def register(name, handler, mask=None, filename=None, lineno=None):
 def remove(name, handler):
     """Remove an Event handler"""
+    if name in _catchall_handlers:
+        _catchall_handlers.pop(name)
+    for event in _event_handler_map.keys():
+        if name in _event_handler_map[event]:
+            _event_handler_map[event].pop(name)
 def get_handlers():
     return _handlers
@@ -783,4 +788,3 @@ class NetworkTestFailed(Event):
     Event to indicate network test has failed

More information about the bitbake-devel mailing list