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

add compatibility shim for enum34 backport #71168

Closed
ethanfurman opened this issue May 8, 2016 · 9 comments
Closed

add compatibility shim for enum34 backport #71168

ethanfurman opened this issue May 8, 2016 · 9 comments
Assignees
Labels
type-bug An unexpected behavior, bug, or error

Comments

@ethanfurman
Copy link
Member

BPO 26981
Nosy @warsaw, @ericvsmith, @ethanfurman
Superseder
  • bpo-26988: Add AutoNumberedEnum to stdlib
  • 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 2016-08-20.14:21:28.451>
    created_at = <Date 2016-05-08.23:45:21.159>
    labels = ['type-bug']
    title = 'add compatibility shim for enum34 backport'
    updated_at = <Date 2016-08-20.15:57:12.847>
    user = 'https://github.com/ethanfurman'

    bugs.python.org fields:

    activity = <Date 2016-08-20.15:57:12.847>
    actor = 'ethan.furman'
    assignee = 'ethan.furman'
    closed = True
    closed_date = <Date 2016-08-20.14:21:28.451>
    closer = 'ethan.furman'
    components = []
    creation = <Date 2016-05-08.23:45:21.159>
    creator = 'ethan.furman'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 26981
    keywords = []
    message_count = 9.0
    messages = ['265174', '265175', '265176', '272072', '273191', '273214', '273216', '273220', '273221']
    nosy_count = 6.0
    nosy_names = ['barry', 'eric.smith', 'eli.bendersky', 'SilentGhost', 'ethan.furman', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = '26988'
    type = 'behavior'
    url = 'https://bugs.python.org/issue26981'
    versions = ['Python 3.6']

    @ethanfurman
    Copy link
    Member Author

    _sunder_ methods are reserved for internal Enum use, and if the user tries to use any an exception is raised.

    Consequently, the enum34 backport uses __order__ instead of _order_ to specify a definition order for its members.

    I would like to do two things:

    1. add _order_ to the stdlib version

    2. ensure the actual definition order is the same as what is specified
      in _order_

    @ethanfurman ethanfurman self-assigned this May 8, 2016
    @ethanfurman ethanfurman added the type-bug An unexpected behavior, bug, or error label May 8, 2016
    @ericvsmith
    Copy link
    Member

    Doesn't namedtuple use _fields (as opposed to _fields_) for a similar purpose? Would Enum using _order be more consistent with that?

    @ethanfurman
    Copy link
    Member Author

    It would, but that's not what we did.

    Currently we have _name_ and _value_; the backport uses __order__ because I didn't want the stdlib version having a hairball when someone tried to use a 2.7 Enum in 3.4 and it didn't occur to me at the time to just add and ignore _order_.

    @ethanfurman
    Copy link
    Member Author

    Done in bpo-26988.

    @ethanfurman
    Copy link
    Member Author

    bpo-26988 reverted. Need to add shim here.

    @ethanfurman ethanfurman reopened this Aug 20, 2016
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Aug 20, 2016

    New changeset 10830e1b2966 by Ethan Furman in branch 'default':
    bpo-26981: add _order_ compatibility shim to enum.Enum
    https://hg.python.org/cpython/rev/10830e1b2966

    @SilentGhost
    Copy link
    Mannequin

    SilentGhost mannequin commented Aug 20, 2016

    Ethan, in Misc/NEWS it says "compatibility ship"

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Aug 20, 2016

    New changeset bdfd4c8384de by Ethan Furman in branch 'default':
    bpo-26981: fix typo
    https://hg.python.org/cpython/rev/bdfd4c8384de

    @ethanfurman
    Copy link
    Member Author

    Thanks!

    @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
    type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants