Issue #20167: revise condition to accomodate message change.

This commit is contained in:
Terry Jan Reedy 2014-10-09 23:13:36 -04:00
parent 5f16f90d1b
commit 4fe69ba01c

View File

@ -60,8 +60,7 @@ _modifier_names = dict([(name, number)
# destroyed before .__del__ methods here are called. The following # destroyed before .__del__ methods here are called. The following
# is used to selectively ignore shutdown exceptions to avoid # is used to selectively ignore shutdown exceptions to avoid
# 'Exception ignored' messages. See http://bugs.python.org/issue20167 # 'Exception ignored' messages. See http://bugs.python.org/issue20167
APPLICATION_GONE = '''\ APPLICATION_GONE = "application has been destroyed"
can't invoke "bind" command: application has been destroyed'''
# A binder is a class which binds functions to one type of event. It has two # A binder is a class which binds functions to one type of event. It has two
# methods: bind and unbind, which get a function and a parsed sequence, as # methods: bind and unbind, which get a function and a parsed sequence, as
@ -108,9 +107,7 @@ class _SimpleBinder:
self.widget.unbind(self.widgetinst, self.sequence, self.widget.unbind(self.widgetinst, self.sequence,
self.handlerid) self.handlerid)
except tkinter.TclError as e: except tkinter.TclError as e:
if e.args[0] == APPLICATION_GONE: if not APPLICATION_GONE in e.args[0]:
pass
else:
raise raise
# An int in range(1 << len(_modifiers)) represents a combination of modifiers # An int in range(1 << len(_modifiers)) represents a combination of modifiers
@ -243,9 +240,7 @@ class _ComplexBinder:
try: try:
self.widget.unbind(self.widgetinst, seq, id) self.widget.unbind(self.widgetinst, seq, id)
except tkinter.TclError as e: except tkinter.TclError as e:
if e.args[0] == APPLICATION_GONE: if not APPLICATION_GONE in e.args[0]:
break
else:
raise raise
# define the list of event types to be handled by MultiEvent. the order is # define the list of event types to be handled by MultiEvent. the order is
@ -412,9 +407,7 @@ def MultiCallCreator(widget):
try: try:
self.__binders[triplet[1]].unbind(triplet, func) self.__binders[triplet[1]].unbind(triplet, func)
except tkinter.TclError as e: except tkinter.TclError as e:
if e.args[0] == APPLICATION_GONE: if not APPLICATION_GONE in e.args[0]:
break
else:
raise raise
_multicall_dict[widget] = MultiCall _multicall_dict[widget] = MultiCall