Skip to contentSkip to conversation

event.py: fix regression about INVALIDCONF

PATCH New Chen Qi 1 participant 1 message Feb 23, 2021

lore
Share & tools
lore

Chen Qi

author
#0 lore raw

PATCH v2 1/1 event.py: fix regression about INVALIDCONF

A previous commit uses __BBHANDLERS_MC to record all handlers, but it does not take into consideration of INVALIDCONF, thus causing regression.

We need to record the name before returned AlreadyRegistered, otherwise, when reparsing due to INVALIDCONF, bascially all handlers are not called.

---
 lib/bb/event.py | 4 ++++
 1 file changed, 4 insertions(+)
lib/bb/event.py +4 -0
index 23e1f318..3e571839 100644
@@ -238,6 +238,10 @@ def register(name, handler, mask=None, filename=None, lineno=None, data=None):
 
     # already registered
     if name in _handlers:
+        if data:
+            bbhands_mc = (data.getVar("__BBHANDLERS_MC") or [])
+            bbhands_mc.append(name)
+            data.setVar("__BBHANDLERS_MC", bbhands_mc)
         return AlreadyRegistered
 
     if handler is not None:
Signature · 1 line
2.17.1