classification
Title: Restore default __str__ of tkinter.EventType
Type: behavior Stage: resolved
Components: Tkinter Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ethan.furman, miss-islington, serhiy.storchaka, terry.reedy
Priority: normal Keywords: patch

Created on 2020-09-22 08:02 by serhiy.storchaka, last changed 2020-10-09 20:21 by serhiy.storchaka. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 22354 merged serhiy.storchaka, 2020-09-22 08:04
PR 22355 merged serhiy.storchaka, 2020-09-22 08:12
PR 22616 merged miss-islington, 2020-10-09 18:46
PR 22617 merged miss-islington, 2020-10-09 18:49
PR 22622 merged miss-islington, 2020-10-09 19:57
PR 22623 merged miss-islington, 2020-10-09 19:58
Messages (7)
msg377306 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-09-22 08:02
The tkinter.EventType enum was introduced in issue27294. It implements __str__ as returning the name for the sole purpose of using in Event.__repr__(). But overriding __str__ in the str subclass may be not good idea, because different code will get different string representation, depending on whether it calls str() explicitly or implicitly (Python code) or read the content of the str object directly using C API (C code).

The following code sets EventType.__str__ = str.__str__, so both method will get the same value. Instead Event.__repr__() was changed to use the name of the enum member directly.
msg378335 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-10-09 18:45
New changeset f25323a307a72c40862c87c2df822f83be6645da by Serhiy Storchaka in branch 'master':
bpo-41831: Add tests for tkinter.Event.__repr__ (GH-22354)
https://github.com/python/cpython/commit/f25323a307a72c40862c87c2df822f83be6645da
msg378336 - (view) Author: miss-islington (miss-islington) Date: 2020-10-09 19:05
New changeset 86938548d5829400065d2705e3d25604c14b23b7 by Miss Skeleton (bot) in branch '3.8':
bpo-41831: Add tests for tkinter.Event.__repr__ (GH-22354)
https://github.com/python/cpython/commit/86938548d5829400065d2705e3d25604c14b23b7
msg378341 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-10-09 19:56
New changeset 43c3eafa1bcdc522870e112d3e2d67ce2451c34b by Miss Skeleton (bot) in branch '3.9':
bpo-41831: Add tests for tkinter.Event.__repr__ (GH-22354) (GH-22617)
https://github.com/python/cpython/commit/43c3eafa1bcdc522870e112d3e2d67ce2451c34b
msg378342 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-10-09 19:57
New changeset eb38c6b7aa35d3003ec0958533421902d19ce408 by Serhiy Storchaka in branch 'master':
bpo-41831: Restore str implementation of __str__ in tkinter.EventType (GH-22355)
https://github.com/python/cpython/commit/eb38c6b7aa35d3003ec0958533421902d19ce408
msg378348 - (view) Author: miss-islington (miss-islington) Date: 2020-10-09 20:21
New changeset 1f75fc7a9d9efbced2e0b0001ac148268a626d63 by Miss Skeleton (bot) in branch '3.9':
bpo-41831: Restore str implementation of __str__ in tkinter.EventType (GH-22355)
https://github.com/python/cpython/commit/1f75fc7a9d9efbced2e0b0001ac148268a626d63
msg378349 - (view) Author: miss-islington (miss-islington) Date: 2020-10-09 20:21
New changeset f8ebb7b62ea266df5c6e0f910b7a6b0eb73deee4 by Miss Skeleton (bot) in branch '3.8':
bpo-41831: Restore str implementation of __str__ in tkinter.EventType (GH-22355)
https://github.com/python/cpython/commit/f8ebb7b62ea266df5c6e0f910b7a6b0eb73deee4
History
Date User Action Args
2020-10-09 20:21:54serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-10-09 20:21:18miss-islingtonsetmessages: + msg378349
2020-10-09 20:21:03miss-islingtonsetmessages: + msg378348
2020-10-09 19:58:03miss-islingtonsetpull_requests: + pull_request21603
2020-10-09 19:57:54miss-islingtonsetpull_requests: + pull_request21602
2020-10-09 19:57:42serhiy.storchakasetmessages: + msg378342
2020-10-09 19:56:27serhiy.storchakasetmessages: + msg378341
2020-10-09 19:05:29miss-islingtonsetmessages: + msg378336
2020-10-09 18:49:18miss-islingtonsetpull_requests: + pull_request21598
2020-10-09 18:46:06miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request21597
2020-10-09 18:45:57serhiy.storchakasetmessages: + msg378335
2020-09-22 08:12:39serhiy.storchakasetpull_requests: + pull_request21393
2020-09-22 08:04:30serhiy.storchakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request21392
2020-09-22 08:02:08serhiy.storchakacreate