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 2011年07月04日 10:18 by scode, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg139746 - (view) | Author: Peter Schuller (scode) | Date: 2011年07月04日 10:18 | |
The documentation states it returns a "file-like object". In Python 2.5+ I expect such file-like objects to have a context manager for use with the with statement. In my particular use-case, the lack comes from urllib.addinfourl but I have not investigated what the possible types returned may be. |
|||
| msg139797 - (view) | Author: Julian Berman (Julian) * | Date: 2011年07月04日 18:03 | |
You probably should bring this up again on #4972 which is being worked on. (and for the immediate future you have contextlib.closing too in case you hadn't seen it already) |
|||
| msg139807 - (view) | Author: Senthil Kumaran (orsenthil) * (Python committer) | Date: 2011年07月04日 21:09 | |
It should be documented that in 2.x series the file-like object does not support context management protocol. I have added the superseder issue number, please see the note as if you really want in 2.x, how you can have it using contextlib and in 3.x the context management protocol support is available. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:19 | admin | set | github: 56696 |
| 2011年07月04日 21:09:07 | orsenthil | set | status: open -> closed resolution: duplicate messages: + msg139807 superseder: URLopener should support context manager protocol stage: resolved |
| 2011年07月04日 18:03:05 | Julian | set | nosy:
+ Julian messages: + msg139797 |
| 2011年07月04日 16:34:50 | ned.deily | set | nosy:
+ orsenthil |
| 2011年07月04日 10:18:24 | scode | create | |