Patches item #1468808, was opened at 2006-04-11 12:48
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1468808&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Tkinter
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Russell Owen (reowen)
Assigned to: Martin v. Löwis (loewis)
Summary: tkFont: simple fix to error at shutdown
Initial Comment:
At shutdown, tkFont may produce the following error
message:
Exception exceptions.AttributeError: "'NoneType' object
has no attribute 'TclError'" in <bound method
Font.__del__ of <tkFont.Font instance at 0x76f418>> ignored
Here's the relevant code as presently implemented:
def __del__(self):
try:
if self.delete_font:
self._call("font", "delete", self.name)
except (AttributeError, Tkinter.TclError):
pass
apparently Tkinter doesn't always exist at shutdown, so
Tkinter.TclError becomes None.TclError, which causes
the trouble.
Here's the trivial fix:
def __del__(self):
try:
if self.delete_font:
self._call("font", "delete", self.name)
except Exception:
pass
Note that this relies on the new exception hierachy in
python 2.5. If this is to be used in 2.4.x then one
should include the usual guard lines before "except
Exception:"
except (SystemExit, KeyboardInterrupt):
raise
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1468808&group_id=5470
_______________________________________________
Patches mailing list
[email protected]
http://mail.python.org/mailman/listinfo/patches