Skip to contentSkip to conversation

event.py: fix regression about INVALIDCONF

PATCH Chen Qi 1 participant 1 message Mar 1, 2021 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Chen Qi

author
#1 lore raw

ping

Quoted 30 lines · Chen Qi

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: