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 2010-08-21 03:11 by benjamin.peterson. 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
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