diff --git a/umsgpack.py b/umsgpack.py index c0647e0..ddc5151 100644 --- a/umsgpack.py +++ b/umsgpack.py @@ -123,6 +123,13 @@ def __str__(self): s += ")" return s + def __hash__(self): + """ + Allow to hash extensions, thus allowing them as map keys. + """ + return hash((self.type, self.data)) + + class InvalidString(bytes): """Subclass of bytes to hold invalid UTF-8 strings.""" pass