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.
Created on 2009年10月17日 21:29 by joe.amenta, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| issue7162.patch | rcoyner, 2010年02月28日 00:46 | review | ||
| issue7162-2.patch | rcoyner, 2010年02月28日 00:48 | review | ||
| issue7162-3.patch | joe.amenta, 2010年03月08日 02:26 | Modified issue7162-2.patch to use is_probably_builtin to check that file() | review | |
| Messages (6) | |||
|---|---|---|---|
| msg94190 - (view) | Author: Joe Amenta (joe.amenta) | Date: 2009年10月17日 21:29 | |
Step to reproduce:
$ echo 'file("/some/file")' | python `which 2to3` -
(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.
|
|||
| msg100196 - (view) | Author: Ryan Coyner (rcoyner) | Date: 2010年02月28日 00:46 | |
Patch attached. Unit test and documentation included. COMMITMSG: Adds a new fixer to lib2to3 which replaces the deprecated builtin "file" with "open". |
|||
| msg100197 - (view) | Author: Ryan Coyner (rcoyner) | Date: 2010年02月28日 00:48 | |
Woops. Removed the extra comments. Updated patch attached. |
|||
| msg100598 - (view) | Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) | Date: 2010年03月07日 18:21 | |
Unfortunately this patch would also replace legitimate uses of a "file" function. |
|||
| msg100612 - (view) | Author: Ryan Coyner (rcoyner) | Date: 2010年03月07日 21:24 | |
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? >>> file in list(__builtins__.__dict__.values()) True >>> def file(): ... pass ... >>> file in list(__builtins__.__dict__.values()) False >>> [1] - http://docs.python.org/library/functions.html?highlight=file#file [2] - http://docs.python.org/3.1/whatsnew/3.0.html#builtins |
|||
| msg100627 - (view) | Author: Joe Amenta (joe.amenta) | Date: 2010年03月08日 02:26 | |
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. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:54 | admin | set | github: 51411 |
| 2021年10月20日 22:44:58 | iritkatriel | set | status: open -> closed superseder: Close 2to3 issues and list them here resolution: wont fix stage: patch review -> resolved |
| 2014年07月03日 05:58:01 | berker.peksag | set | nosy:
+ berker.peksag |
| 2014年07月03日 05:57:55 | berker.peksag | set | versions: + Python 3.4, Python 3.5, - Python 3.1, Python 3.2, Python 3.3 |
| 2010年09月20日 21:17:59 | eric.araujo | set | nosy:
+ eric.araujo versions: + Python 3.3, - Python 2.6, Python 3.0, Python 2.7 |
| 2010年08月21日 03:11:35 | benjamin.peterson | link | issue9648 superseder |
| 2010年03月08日 02:26:11 | joe.amenta | set | files:
+ issue7162-3.patch messages: + msg100627 |
| 2010年03月07日 21:24:33 | rcoyner | set | messages: + msg100612 |
| 2010年03月07日 18:21:02 | amaury.forgeotdarc | set | nosy:
+ amaury.forgeotdarc, benjamin.peterson messages: + msg100598 assignee: benjamin.peterson stage: patch review |
| 2010年02月28日 00:48:34 | rcoyner | set | files:
+ issue7162-2.patch messages: + msg100197 |
| 2010年02月28日 00:46:17 | rcoyner | set | files:
+ issue7162.patch nosy: + rcoyner messages: + msg100196 keywords: + patch |
| 2009年10月18日 04:10:19 | joe.amenta | set | type: behavior |
| 2009年10月17日 21:29:37 | joe.amenta | create | |