You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
issue7162-3.patch: Modified issue7162-2.patch to use is_probably_builtin to check that 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='https://github.com/benjaminp'closed_at=<Date2021-10-20.22:44:58.765>created_at=<Date2009-10-17.21:29:37.812>labels= ['type-bug', 'expert-2to3']
title='2to3 does not convert __builtins__.file'updated_at=<Date2021-10-20.22:44:58.764>user='https://bugs.python.org/joeamenta'
I thought the whole point was that file[1] was removed in 3.0[2]? Or, are you saying that if somebody overloaded file with def file(...)? If that is the case would it be reasonable to check like this?
Activity
joeamenta commentedon Oct 17, 2009
Step to reproduce:
(replace python with whichever python executable version you wish to
use, e.g. ~/python-trunk/python or /usr/local/bin/python3.2 )
Expected result:
Anything referring to the fact that the "file" type no longer exists in
python 3.x, whether it be a warning or a refactoring.
Actual result:
RefactoringTool: No files need to be modified.
Just a report for now, I don't have the time to write a patch.
rcoyner commentedon Feb 28, 2010
Patch attached. Unit test and documentation included.
COMMITMSG:
Adds a new fixer to lib2to3 which replaces the deprecated builtin "file" with "open".
rcoyner commentedon Feb 28, 2010
Woops. Removed the extra comments. Updated patch attached.
amauryfa commentedon Mar 7, 2010
Unfortunately this patch would also replace legitimate uses of a "file" function.
rcoyner commentedon Mar 7, 2010
I thought the whole point was that file[1] was removed in 3.0[2]? Or, are you saying that if somebody overloaded file with def file(...)? If that is the case would it be reasonable to check like this?
[1] - http://docs.python.org/library/functions.html?highlight=file#file
[2] - http://docs.python.org/3.1/whatsnew/3.0.html#builtins
joeamenta commentedon Mar 8, 2010
Yes, the idea was that it doesn't seem outlandish for someone to do:
def file(something):
do_stuff()
You can use lib2to3.fixer_util.is_probably_builtin for this... modified the patch and attached.