Bugs item #802310, was opened at 2003-09-08 00:52 Message generated for change (Comment added) made by lpd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=802310&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: 3 Private: No Submitted By: Fredrik Lundh (effbot) Assigned to: Nobody/Anonymous (nobody) Summary: tkFont may reuse font names Initial Comment: (sent to me instead of to the bug manager; note that the tkFont naming approach is also used for widgets and callbacks /F) The class tkFont has a problem name it chooses if no name is given. The choosen method 'name = "font" + str(id (self))' isn't safe because the name may exists longer than the Font object and so another Font object may be created with a different font but the same id() and so the same name. id() says Return the identity of an object. This is guaranteed to be unique among simultaneously existing objects. ^^^^^^^^^^^^^^^^^^^^^^^ Note that this bug doesn't strike if you hold a reference to the Font object and so the GC can't reclaim the space. To reproduce run the attached program. It produces something like: previously: ('Times', 15, 'bold') now: ('Times', 18, 'bold') iterations: 8 mapping: {'font136494612': ('Times', 14, 'bold'), 'font136499772': ('Times', 15, 'bold'), 'font136545468': ('Times', 17, 'bold'), 'font136483156': ('Times', 11, 'bold'), 'font136502700': ('Times', 12, 'bold'), 'font136510460': ('Times', 13, 'bold'), 'font136515228': ('Times', 16, 'bold'), 'font136365348': ('Times', 10, 'bold')} Traceback (most recent call last): File "tkfont_bug.py", line 20, in ? assert 0 AssertionError Raimar ---------------------------------------------------------------------- Comment By: L. Peter Deutsch (lpd) Date: 2007-06-02 22:16 Message: Logged In: YES user_id=8861 Originator: NO This bug has bitten me too, in a real program. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=802310&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com