From fed64a12b57c8c2425173cb7e92ce72f4e4d43a3 Mon Sep 17 00:00:00 2001
From: Sven Gestegard Robertz <sven.robertz@cs.lth.se>
Date: Tue, 11 Aug 2015 10:27:00 +0200
Subject: [PATCH] added debug output to show the handler lookup problem in
 python

---
 lib/python/labcomm2014/LabComm.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lib/python/labcomm2014/LabComm.py b/lib/python/labcomm2014/LabComm.py
index b309124..a11f9cd 100644
--- a/lib/python/labcomm2014/LabComm.py
+++ b/lib/python/labcomm2014/LabComm.py
@@ -919,7 +919,7 @@ class Decoder(Codec):
         self.handlers = {}
 
     def register_handler(self, sig, handler):
-        self.handlers[str(sig)] = handler
+        self.handlers[sig] = handler
 
     def unpack(self, format):
         size = packer.calcsize(format)
@@ -956,11 +956,16 @@ class Decoder(Codec):
              data,decl = self.decode()
         if decl:
             if data != None:
-                if str(decl) in self.handlers:
-                    handler = self.handlers[str(decl)]
+                if decl in self.handlers:
+                    handler = self.handlers[decl]
                     handler(data)
                 else:
                     print ("No handler for %s" % decl.name )
+                    for key, value in self.handlers.iteritems():
+                        if key == decl:
+                            print "but value %s == decl %s" % (key,decl)
+                            print "hashes %d : %d" % (hash(key),hash(decl))
+
 
     def decode(self):
         while True:
-- 
GitLab