Commits

Jason R. Coombs  committed b5ba28c

Fix errors when handlers of the same priority are added under Python 3. Also fixes the unintended behavior of allowing handlers of the same priority to compare as unequal. Fixes #14.

  • Participants
  • Parent commits 5a3c2ba
  • Tags 8.0.1

Comments (0)

Files changed (2)

 Changes
 -------
 
+8.0.1
+=====
+
+* Issue #14: Fix errors when handlers of the same priority are added under
+  Python 3. This also fixes the unintended behavior of allowing handlers of
+  the same priority to compare as unequal.
+
 8.0
 ===
 

File irc/client.py

 class MessageTooLong(ValueError):
     "Message is too long"
 
-PrioritizedHandler = collections.namedtuple('PrioritizedHandler',
-    ('priority', 'callback'))
+class PrioritizedHandler(
+        collections.namedtuple('Base', ('priority', 'callback'))):
+    def __lt__(self, other):
+        "when sorting prioritized handlers, only use the priority"
+        return self.priority < other.priority
 
 class IRC(object):
     """Class that handles one or several IRC server connections.