Closed jaraco closed 8 years ago
Aah. Good catch. If the priorities are the same, then the comparison will compare the callbacks. Thanks for the report.
Original comment by: Jason R. Coombs
I believe this issue only exists on Python 3. On Python 2, functions and methods are orderable, so the comparison allowed the callback to be used in the comparison.
Original comment by: Jason R. Coombs
Code for reproducing
#!python
import irc.client
class class1(object):
def get_handler(self):
return getattr(self, "_on_join")
def _on_join(self, connection, event):
pass
class class2(object):
def get_handler(self):
return getattr(self, "_on_join")
def _on_join(self, connection, event):
pass
c1 = class1()
c2 = class2()
client = irc.client.SimpleIRCClient()
client.ircobj.add_global_handler("join", c1.get_handler())
client.ircobj.add_global_handler("join", c2.get_handler())
Original comment by: coffeeburrito
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.
→ <
Original comment by: Jason R. Coombs
Released as 8.0.1. Enjoy.
Original comment by: Jason R. Coombs
Playing around with event handlers, you may encounter this error:
File "\irc\client.py", line 292 in add_global_handler
bisect.insort(event_handlers, handler)
TypeError: unorderable types: method() < method()
To fix it, replace this:
with: