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

enumerate no longer accepts iterable keyword argument #90685

Closed
treyhunner opened this issue Jan 26, 2022 · 4 comments
Closed

enumerate no longer accepts iterable keyword argument #90685

treyhunner opened this issue Jan 26, 2022 · 4 comments
Labels
3.11 only security fixes release-blocker stdlib Python modules in the Lib dir

Comments

@treyhunner
Copy link
Member

BPO 46527
Nosy @rhettinger, @JelleZijlstra, @treyhunner, @corona10
PRs
  • bpo-46527: allow calling enumerate(iterable=...) again #30904
  • 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 2022-01-26.15:47:40.365>
    created_at = <Date 2022-01-26.01:14:56.541>
    labels = ['release-blocker', 'library', '3.11']
    title = 'enumerate no longer accepts iterable keyword argument'
    updated_at = <Date 2022-01-26.15:47:40.364>
    user = 'https://github.com/treyhunner'

    bugs.python.org fields:

    activity = <Date 2022-01-26.15:47:40.364>
    actor = 'corona10'
    assignee = 'none'
    closed = True
    closed_date = <Date 2022-01-26.15:47:40.365>
    closer = 'corona10'
    components = ['Library (Lib)']
    creation = <Date 2022-01-26.01:14:56.541>
    creator = 'trey'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 46527
    keywords = ['patch']
    message_count = 4.0
    messages = ['411695', '411702', '411760', '411761']
    nosy_count = 4.0
    nosy_names = ['rhettinger', 'JelleZijlstra', 'trey', 'corona10']
    pr_nums = ['30904']
    priority = 'release blocker'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue46527'
    versions = ['Python 3.11']

    @treyhunner
    Copy link
    Member Author

    While playing around with the main CPython branch against I noticed that enumerate now gives a strange error message when iterable is provided as a keyword argument:

    >>> enumerate(iterable=[])
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: enumerate() missing required argument 'iterable'

    When passing an invalid keyword argument (and no positional arguments) an interesting error message is also given:

    >>> enumerate(hello="world")
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: enumerate() missing required argument 'iterable'

    The help output still shows that iterable is accepted as either a keyword argument or a positional argument.

    @treyhunner treyhunner added 3.11 only security fixes stdlib Python modules in the Lib dir labels Jan 26, 2022
    @JelleZijlstra
    Copy link
    Member

    I can confirm that the behavior changed between 3.10 and current main: enumerate(iterable=[]) works on 3.10 but not on main. It's likely a consequence of bpo-43706.

    I'll submit a patch to restore the previous behavior.

    @corona10
    Copy link
    Member

    New changeset ac0c6e1 by Jelle Zijlstra in branch 'main':
    bpo-46527: allow calling enumerate(iterable=...) again (GH-30904)
    ac0c6e1

    @corona10
    Copy link
    Member

    So since no more regression is expected, I would like to propose merging the PR and once we need to change the implementation, we can revert Vectorcall anytime, Rollbacking Vectorcall will not raise any behavior regression so anytime we can rollback it.

    @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.11 only security fixes release-blocker stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants