Skip to content

2to3 doesn't convert "file" usage to an "open" equivalent #53857

Closed

Description

@briancurtin
BPO 9648
Nosy @briancurtin
Superseder
  • bpo-7162: 2to3 does not convert builtins.file
  • 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 2010-08-21.03:11:35.655>
    created_at = <Date 2010-08-20.01:59:35.639>
    labels = ['type-bug']
    title = '2to3 doesn\'t convert "file" usage to an "open" equivalent'
    updated_at = <Date 2010-08-21.03:11:35.654>
    user = 'https://github.com/briancurtin'

    bugs.python.org fields:

    activity = <Date 2010-08-21.03:11:35.654>
    actor = 'benjamin.peterson'
    assignee = 'none'
    closed = True
    closed_date = <Date 2010-08-21.03:11:35.655>
    closer = 'benjamin.peterson'
    components = []
    creation = <Date 2010-08-20.01:59:35.639>
    creator = 'brian.curtin'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 9648
    keywords = []
    message_count = 1.0
    messages = ['114417']
    nosy_count = 1.0
    nosy_names = ['brian.curtin']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'needs patch'
    status = 'closed'
    superseder = '7162'
    type = 'behavior'
    url = 'https://bugs.python.org/issue9648'
    versions = ['Python 3.2']

    Activity

    1. briancurtin commented on Aug 20, 2010

      @briancurtin
      MemberAuthor

      """
      with file("sample.py", "r") as f:
      pass
      """

      The above code comes out of 2to3 with no modifications suggested. "file" is gone in 3.x and could be substituted with "open" usage in most cases. We would also have to handle or otherwise notify the user about code like "isinstance(x, file)".

    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

      Labels

      type-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions