Fixed dealing with deleting handlers.

The call to .index() may raise a ValueError if the item is not in the
list. So both the .index() and .pop() calls should be in the try block.
This commit is contained in:
Lance Stout 2010-10-07 09:17:28 -04:00
parent 88d21d210c
commit 78141fe5f3

View file

@ -492,8 +492,8 @@ class XMLStream(object):
# remove it now instead of waiting for it to be # remove it now instead of waiting for it to be
# processed in the queue. # processed in the queue.
with self.__event_handlers_lock: with self.__event_handlers_lock:
handler_index = self.__event_handlers[name].index(handler)
try: try:
handler_index = self.__event_handlers[name].index(handler)
self.__event_handlers[name].pop(handler_index) self.__event_handlers[name].pop(handler_index)
except: except:
pass pass