Message18102
| Author |
effbot |
| Recipients |
| Date |
2003年09月08日.07:52:56 |
| SpamBayes Score |
| Marked as misclassified |
| Message-id |
| In-reply-to |
| Content |
(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
|
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2007年08月23日 14:16:43 | admin | link | issue802310 messages |
| 2007年08月23日 14:16:43 | admin | create |
|