This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: 2to3 doesn't convert "file" usage to an "open" equivalent
Type: behavior Stage: needs patch
Components: Versions: Python 3.2
process
Status: closed Resolution: duplicate
Dependencies: Superseder: 2to3 does not convert __builtins__.file
View: 7162
Assigned To: Nosy List: brian.curtin
Priority: normal Keywords:

Created on 2010-08-20 01:59 by brian.curtin, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (1)
msg114417 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2010-08-20 01:59
"""
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)".
History
Date User Action Args
2022-04-11 14:57:05adminsetgithub: 53857
2010-08-21 03:11:35benjamin.petersonsetstatus: open -> closed
resolution: duplicate
superseder: 2to3 does not convert __builtins__.file
2010-08-20 01:59:35brian.curtincreate