Skip to content

Invalid (... and confusing) warning raised by 2to3 regarding repeat #69713

Closed

Description

@anntzer
mannequin
BPO 25527
Nosy @benjaminp, @anntzer
Superseder
  • bpo-45544: Close 2to3 issues and list them here
  • 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 2021-10-20.22:46:35.167>
    created_at = <Date 2015-11-01.09:49:58.276>
    labels = ['expert-2to3']
    title = 'Invalid (... and confusing) warning raised by 2to3 regarding repeat'
    updated_at = <Date 2021-10-20.22:46:35.166>
    user = 'https://github.com/anntzer'

    bugs.python.org fields:

    activity = <Date 2021-10-20.22:46:35.166>
    actor = 'iritkatriel'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-10-20.22:46:35.167>
    closer = 'iritkatriel'
    components = ['2to3 (2.x to 3.x conversion tool)']
    creation = <Date 2015-11-01.09:49:58.276>
    creator = 'Antony.Lee'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 25527
    keywords = []
    message_count = 1.0
    messages = ['253835']
    nosy_count = 2.0
    nosy_names = ['benjamin.peterson', 'Antony.Lee']
    pr_nums = []
    priority = 'normal'
    resolution = 'wont fix'
    stage = 'resolved'
    status = 'closed'
    superseder = '45544'
    type = None
    url = 'https://bugs.python.org/issue25527'
    versions = ['Python 2.7', 'Python 3.5', 'Python 3.6']

    Activity

    1. anntzer commented on Nov 1, 2015

      anntzermannequin
      MannequinAuthor
      $ echo 'from numpy import repeat\nrepeat(2, 3)' | 2to3 -
      RefactoringTool: Skipping optional fixer: buffer
      RefactoringTool: Skipping optional fixer: idioms
      RefactoringTool: Skipping optional fixer: set_literal
      RefactoringTool: Skipping optional fixer: ws_comma
      RefactoringTool: No files need to be modified.
      RefactoringTool: Warnings/messages while refactoring:
      RefactoringTool: ### In file <stdin> ###
      RefactoringTool: Line 2: You should use 'operator.mul(2, 3)' here.

      numpy.repeat(2, 3) returns np.array([2, 2, 2]) but 2to3 confuses it with the old operator.repeat. It may be impossible to resolve in general which function the author wanted to call but perhaps the warning should only be raised if the operator module is imported at some point? (or clarify the error message)

    2. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions