This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2003年09月08日 07:52 by effbot, last changed 2022年04月10日 16:11 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| tkfont_bug.py | effbot, 2003年09月08日 07:52 | |||
| nonamerepeat.diff | gpolo, 2009年06月21日 20:49 | review | ||
| Messages (7) | |||
|---|---|---|---|
| msg18102 - (view) | Author: Fredrik Lundh (effbot) * (Python committer) | Date: 2003年09月08日 07:52 | |
(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
|
|||
| msg18103 - (view) | Author: L. Peter Deutsch (lpd) | Date: 2007年06月03日 05:16 | |
This bug has bitten me too, in a real program. |
|||
| msg64948 - (view) | Author: Guilherme Polo (gpolo) * (Python committer) | Date: 2008年04月04日 20:17 | |
This still happens, but around 2000 iterations here on newer Python versions (trunk, 3alpha, 2.5.x, 2.4.x). Using Python 1.6 I've got it at 2 iterations (min), but.. is this going to be fixed or given the amount of iterations needed nowadays this is no longer a problem ? If it should be fixed, are there any suggestions on how to proceed ? |
|||
| msg89581 - (view) | Author: Guilherme Polo (gpolo) * (Python committer) | Date: 2009年06月21日 20:49 | |
Uhm, now I'm getting it at around 3 iterations with python-trunk. So, can't we just use a simple generator for this ? Patch attached. The same could be done for widget and callback naming. |
|||
| msg114268 - (view) | Author: Mark Lawrence (BreamoreBoy) * | Date: 2010年08月18日 19:26 | |
Patch is really simple and looks ok to me, can we get this committed please. |
|||
| msg157394 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2012年04月03日 06:48 | |
New changeset a77e23135675 by Andrew Svetlov in branch 'default': Issue #802310: Generate always unique tkinter font names if not directly passed http://hg.python.org/cpython/rev/a77e23135675 |
|||
| msg157395 - (view) | Author: Andrew Svetlov (asvetlov) * (Python committer) | Date: 2012年04月03日 06:51 | |
I've pushed fix inspired by Guilherme's suggestion. Fix has been applied to 3.3 only because: 1. It changes font name generation schema 2. It's definitelly minor issue as exists starting from 2003. Thanks. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月10日 16:11:04 | admin | set | github: 39201 |
| 2012年04月03日 06:51:05 | asvetlov | set | status: open -> closed versions: - Python 2.7, Python 3.2 messages: + msg157395 resolution: fixed stage: patch review -> resolved |
| 2012年04月03日 06:48:13 | python-dev | set | nosy:
+ python-dev messages: + msg157394 |
| 2012年04月03日 05:42:28 | asvetlov | set | assignee: asvetlov |
| 2012年03月21日 17:27:30 | asvetlov | set | nosy:
+ asvetlov versions: + Python 3.3, - Python 3.1 |
| 2010年08月18日 19:26:28 | BreamoreBoy | set | versions:
+ Python 3.1, Python 2.7, Python 3.2 nosy: + BreamoreBoy messages: + msg114268 type: behavior stage: patch review |
| 2009年06月21日 20:49:11 | gpolo | set | files:
+ nonamerepeat.diff keywords: + patch messages: + msg89581 |
| 2008年04月04日 20:17:01 | gpolo | set | nosy:
+ gpolo messages: + msg64948 |
| 2003年09月08日 07:52:56 | effbot | create | |