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

pstats.SortKey enum is broken #85977

Closed
ethanfurman opened this issue Sep 19, 2020 · 4 comments
Closed

pstats.SortKey enum is broken #85977

ethanfurman opened this issue Sep 19, 2020 · 4 comments
Assignees
Labels
3.8 only security fixes 3.9 only security fixes 3.10 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@ethanfurman
Copy link
Member

BPO 41811
Nosy @ethanfurman, @miss-islington
PRs
  • bpo-41811: create SortKey members using first given value #22316
  • [3.9] bpo-41811: create SortKey members using first given value (GH-22316) #22325
  • [3.8] bpo-41811: create SortKey members using first given value (GH-22316) #22326
  • 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 = 'https://github.com/ethanfurman'
    closed_at = <Date 2020-09-19.19:57:36.650>
    created_at = <Date 2020-09-19.08:49:31.371>
    labels = ['3.8', 'type-bug', 'library', '3.9', '3.10']
    title = 'pstats.SortKey enum is broken'
    updated_at = <Date 2020-09-19.19:57:36.650>
    user = 'https://github.com/ethanfurman'

    bugs.python.org fields:

    activity = <Date 2020-09-19.19:57:36.650>
    actor = 'ethan.furman'
    assignee = 'ethan.furman'
    closed = True
    closed_date = <Date 2020-09-19.19:57:36.650>
    closer = 'ethan.furman'
    components = ['Library (Lib)']
    creation = <Date 2020-09-19.08:49:31.371>
    creator = 'ethan.furman'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 41811
    keywords = ['patch']
    message_count = 4.0
    messages = ['377153', '377180', '377189', '377190']
    nosy_count = 2.0
    nosy_names = ['ethan.furman', 'miss-islington']
    pr_nums = ['22316', '22325', '22326']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue41811'
    versions = ['Python 3.8', 'Python 3.9', 'Python 3.10']

    @ethanfurman
    Copy link
    Member Author

    Currently, __new__ creates each member as an empty string, then adds the _value_ attribute. Because of this, each member is equal to each other, and all appear the same to any data structure that relies on equality and hash as distinguishers (so, basically, all of them).

    The fix is to use the first value as the string to be created.

    @ethanfurman ethanfurman added 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes labels Sep 19, 2020
    @ethanfurman ethanfurman self-assigned this Sep 19, 2020
    @ethanfurman ethanfurman added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes labels Sep 19, 2020
    @ethanfurman ethanfurman self-assigned this Sep 19, 2020
    @ethanfurman ethanfurman added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Sep 19, 2020
    @ethanfurman
    Copy link
    Member Author

    New changeset ae0d2a3 by Ethan Furman in branch 'master':
    bpo-41811: create SortKey members using first given value (GH-22316)
    ae0d2a3

    @ethanfurman
    Copy link
    Member Author

    New changeset 0e4d526 by Miss Islington (bot) in branch '3.9':
    bpo-41811: create SortKey members using first given value (GH-22316) (GH-22325)
    0e4d526

    @ethanfurman
    Copy link
    Member Author

    New changeset 488e3eb by Miss Islington (bot) in branch '3.8':
    bpo-41811: create SortKey members using first given value (GH-22316) (GH-22326)
    488e3eb

    @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 stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant