[Patches] [ python-Patches-1468808 ] tkFont: simple fix to error at shutdown
SourceForge.net
noreply at sourceforge.net
Wed Apr 12 17:29:07 CEST 2006
Patches item #1468808, was opened at 2006-04-11 19:48
Message generated for change (Comment added) made by gbrandl
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
----------------------------------------------------------------------
>Comment By: Georg Brandl (gbrandl)
Date: 2006-04-12 15:29
Message:
Logged In: YES
user_id=849994
Thanks, resolved in rev. 45310, 45311.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1468808&group_id=5470
More information about the Patches
mailing list