From 9d6db08c5979855de9e8f6aae2d3886f25005677 Mon Sep 17 00:00:00 2001 From: Anders Blomdell <anders.blomdell@control.lth.se> Date: Tue, 11 Aug 2015 11:14:53 +0200 Subject: [PATCH] Run on non-Darwin + removed bogus hash calculations. --- examples/Makefile | 2 +- lib/python/labcomm2014/LabComm.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/Makefile b/examples/Makefile index fc39c55..b217cff 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -17,7 +17,7 @@ ifeq ($(UNAME_S),Darwin) else cd simple ; sh compile.sh && sh run.sh $(MAKE) -C wiki_example test - $(MAKE) -C user_types test + $(MAKE) -C user_types all endif $(MAKE) -C duck_typing test $(MAKE) -C twoway test diff --git a/lib/python/labcomm2014/LabComm.py b/lib/python/labcomm2014/LabComm.py index b309124..b00f0ee 100644 --- a/lib/python/labcomm2014/LabComm.py +++ b/lib/python/labcomm2014/LabComm.py @@ -637,8 +637,7 @@ class struct(type_decl): return not self.__eq__(other) def __hash__(self): - tmp = str(self.field) - return hash(self.__class__) ^ hash(tmp) + return hash(self.__class__) ^ hash(self.field) def encode_decl(self, encoder): encoder.encode_type(i_STRUCT) @@ -961,6 +960,11 @@ class Decoder(Codec): 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)) + raise Exception() def decode(self): while True: -- GitLab