Skip to content

bpo-41831: Restore str implementation of __str__ in tkinter.EventType #22355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Sep 22, 2020

@@ -185,8 +185,7 @@ class EventType(str, enum.Enum):
Deactivate = '37',
MouseWheel = '38',

def __str__(self):
return self.name
__str__ = str.__str__
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is unnecessary if subclassing the new StrEnum, which my patch did. Just remove the def __str__ and we're good.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, this is exactly the change we want for 3.8 and 3.9.

@serhiy-storchaka serhiy-storchaka merged commit eb38c6b into python:master Oct 9, 2020
@miss-islington
Copy link
Contributor

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8, 3.9.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@serhiy-storchaka serhiy-storchaka deleted the tkinter-eventtype-str branch October 9, 2020 19:57
@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label Oct 9, 2020
@bedevere-bot
Copy link

GH-22622 is a backport of this pull request to the 3.9 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 9, 2020
…pythonGH-22355)

(cherry picked from commit eb38c6b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@bedevere-bot
Copy link

GH-22623 is a backport of this pull request to the 3.8 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 9, 2020
…pythonGH-22355)

(cherry picked from commit eb38c6b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
miss-islington added a commit that referenced this pull request Oct 9, 2020
…GH-22355)

(cherry picked from commit eb38c6b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
miss-islington added a commit that referenced this pull request Oct 9, 2020
…GH-22355)

(cherry picked from commit eb38c6b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants