classification
Title: Add __repr__ for Tkinter Font objects
Type: enhancement Stage: resolved
Components: Tkinter Versions: Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: diohabara, epaine, platonoff-dev, serhiy.storchaka
Priority: normal Keywords: easy, patch

Created on 2020-09-28 15:33 by serhiy.storchaka, last changed 2020-10-14 10:03 by serhiy.storchaka. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 22450 merged platonoff-dev, 2020-09-29 10:35
Messages (5)
msg377603 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-09-28 15:33
Currently Font objects have default repr:

    <tkinter.font.Font object at 0x7fa22c3bd1e0>

Since Font is just an object oriented wrapper for font name, and Font objects with the same name are equal, it is worth to show the font name in the repr and do not show an id.

    <tkinter.font.Font object 'TkDefaultFont'>
msg377658 - (view) Author: (diohabara) Date: 2020-09-29 07:21
Hi, Storchaka!.
I would like to tackle this issue.
Because I am new to Python bug tracking, I am unsure that this is the right approach to bug fixing.
msg377660 - (view) Author: E. Paine (epaine) * Date: 2020-09-29 10:11
Serhiy, while I agree this is an enhancement, I don't see that it would break *anyone's* code (this will mostly just affect the REPL output) so is it worth considering a backport?

Diohabara, the Python devguide (https://devguide.python.org/) is a very good place to start. The first contribution is always the hardest so please do ask if you need clarification on something. Likely the first thing you will need to do, though, is sign the CLA which means we can legally accept your patch.
msg377661 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-09-29 10:25
This is a new feature. We do not backport new features to old versions unless they fix some design bug. Nothing bad will happen if we DO NOT backport it.
msg378612 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-10-14 10:02
New changeset b4d895336a4692c95b4533adcc5c63a489e5e4e4 by Anatoliy Platonov in branch 'master':
bpo-41876: Overload __repr__ for tkinter Font objects (GH-22450)
https://github.com/python/cpython/commit/b4d895336a4692c95b4533adcc5c63a489e5e4e4
History
Date User Action Args
2020-10-14 10:03:12serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-10-14 10:02:58serhiy.storchakasetmessages: + msg378612
2020-09-29 10:35:53platonoff-devsetkeywords: + patch
nosy: + platonoff-dev

pull_requests: + pull_request21479
stage: needs patch -> patch review
2020-09-29 10:25:41serhiy.storchakasetmessages: + msg377661
2020-09-29 10:11:51epainesetnosy: + epaine
messages: + msg377660
2020-09-29 07:21:09diohabarasetnosy: + diohabara
messages: + msg377658
2020-09-28 15:33:27serhiy.storchakacreate