Skip to content
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

Restore default __str__ of tkinter.EventType #85997

Closed
serhiy-storchaka opened this issue Sep 22, 2020 · 7 comments
Closed

Restore default __str__ of tkinter.EventType #85997

serhiy-storchaka opened this issue Sep 22, 2020 · 7 comments
Labels
3.8 only security fixes 3.9 only security fixes 3.10 only security fixes topic-tkinter type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

BPO 41831
Nosy @terryjreedy, @ethanfurman, @serhiy-storchaka, @miss-islington
PRs
  • bpo-41831: Add tests for tkinter.Event.__repr__ #22354
  • bpo-41831: Restore str implementation of __str__ in tkinter.EventType #22355
  • [3.8] bpo-41831: Add tests for tkinter.Event.__repr__ (GH-22354) #22616
  • [3.9] bpo-41831: Add tests for tkinter.Event.__repr__ (GH-22354) #22617
  • [3.9] bpo-41831: Restore str implementation of __str__ in tkinter.EventType (GH-22355) #22622
  • [3.8] bpo-41831: Restore str implementation of __str__ in tkinter.EventType (GH-22355) #22623
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2020-10-09.20:21:54.349>
    created_at = <Date 2020-09-22.08:02:08.083>
    labels = ['3.8', 'type-bug', 'expert-tkinter', '3.9', '3.10']
    title = 'Restore default __str__ of tkinter.EventType'
    updated_at = <Date 2020-10-09.20:21:54.349>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2020-10-09.20:21:54.349>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-10-09.20:21:54.349>
    closer = 'serhiy.storchaka'
    components = ['Tkinter']
    creation = <Date 2020-09-22.08:02:08.083>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 41831
    keywords = ['patch']
    message_count = 7.0
    messages = ['377306', '378335', '378336', '378341', '378342', '378348', '378349']
    nosy_count = 4.0
    nosy_names = ['terry.reedy', 'ethan.furman', 'serhiy.storchaka', 'miss-islington']
    pr_nums = ['22354', '22355', '22616', '22617', '22622', '22623']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue41831'
    versions = ['Python 3.8', 'Python 3.9', 'Python 3.10']

    @serhiy-storchaka
    Copy link
    Member Author

    The tkinter.EventType enum was introduced in bpo-27294. 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.

    @serhiy-storchaka serhiy-storchaka added 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes topic-tkinter type-bug An unexpected behavior, bug, or error labels Sep 22, 2020
    @serhiy-storchaka
    Copy link
    Member Author

    New changeset f25323a by Serhiy Storchaka in branch 'master':
    bpo-41831: Add tests for tkinter.Event.__repr__ (GH-22354)
    f25323a

    @miss-islington
    Copy link
    Contributor

    New changeset 8693854 by Miss Skeleton (bot) in branch '3.8':
    bpo-41831: Add tests for tkinter.Event.__repr__ (GH-22354)
    8693854

    @serhiy-storchaka
    Copy link
    Member Author

    New changeset 43c3eaf by Miss Skeleton (bot) in branch '3.9':
    bpo-41831: Add tests for tkinter.Event.__repr__ (GH-22354) (GH-22617)
    43c3eaf

    @serhiy-storchaka
    Copy link
    Member Author

    New changeset eb38c6b by Serhiy Storchaka in branch 'master':
    bpo-41831: Restore str implementation of __str__ in tkinter.EventType (GH-22355)
    eb38c6b

    @miss-islington
    Copy link
    Contributor

    New changeset 1f75fc7 by Miss Skeleton (bot) in branch '3.9':
    bpo-41831: Restore str implementation of __str__ in tkinter.EventType (GH-22355)
    1f75fc7

    @miss-islington
    Copy link
    Contributor

    New changeset f8ebb7b by Miss Skeleton (bot) in branch '3.8':
    bpo-41831: Restore str implementation of __str__ in tkinter.EventType (GH-22355)
    f8ebb7b

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.8 only security fixes 3.9 only security fixes 3.10 only security fixes topic-tkinter type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants