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

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

Closed
anntzer mannequin opened this issue Nov 1, 2015 · 1 comment
Closed

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

anntzer mannequin opened this issue Nov 1, 2015 · 1 comment

Comments

@anntzer
Copy link
Mannequin

anntzer mannequin commented Nov 1, 2015

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']

    @anntzer
    Copy link
    Mannequin Author

    anntzer mannequin commented Nov 1, 2015

    $ 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)

    @anntzer anntzer mannequin added the topic-2to3 label Nov 1, 2015
    @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
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant