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 2008年03月18日 00:13 by benjamin.peterson, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| file_warning.patch | benjamin.peterson, 2008年03月18日 00:13 | gives file a warning | ||
| Messages (4) | |||
|---|---|---|---|
| msg63814 - (view) | Author: Benjamin Peterson (benjamin.peterson) * (Python committer) | Date: 2008年03月18日 00:13 | |
This patch causes the use of builtin file to give a Py3k warning. When Python starts up, distutils.text_file gives a warning because it uses a variable named file. I imagine there are places like this all over in the stdlib, which should be renamed fp or something similar. |
|||
| msg63821 - (view) | Author: Guido van Rossum (gvanrossum) * (Python committer) | Date: 2008年03月18日 00:34 | |
I'll review this. My hunch is that we don't need this -- 2to3 takes care of this so there is no reason to tell people to change their code by hand. (You may notice a pattern -- things that 2to3 can fix easily generally don't deserve -3 warnings or backports, *unless* the backported feature adds significant functionality that's not easily available otherwise in 2.x.) |
|||
| msg63826 - (view) | Author: Guido van Rossum (gvanrossum) * (Python committer) | Date: 2008年03月18日 00:44 | |
Let's not do this. This approach is not sufficiently backwards compatible; it will break any code that uses isinstance(x, file). Even though that's not forward compatible with 3.0, it works in 2.5 and before, so it should not break in 2.6. Together with my previous remark this means that we should just not mess with this. (PS: I don't understand what you say about distutils.text_file -- from your patch it looks like the only way it can issue this warning is if it actually calls the file() builtin...) |
|||
| msg63835 - (view) | Author: Benjamin Peterson (benjamin.peterson) * (Python committer) | Date: 2008年03月18日 01:07 | |
Yeah, breaking isinstance(x, file) would be bad and 2to3 can do this automatically. I should probably learn how to write fixers. BTW, the warning culprit was actually site.py which used file. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:32 | admin | set | github: 46627 |
| 2008年03月18日 01:07:39 | benjamin.peterson | set | messages: + msg63835 |
| 2008年03月18日 00:44:10 | gvanrossum | set | status: open -> closed resolution: rejected messages: + msg63826 |
| 2008年03月18日 00:34:37 | gvanrossum | set | priority: normal assignee: gvanrossum messages: + msg63821 nosy: + gvanrossum |
| 2008年03月18日 00:13:52 | benjamin.peterson | create | |