Martin Panter added the comment: Here is a patch to change the urlopen() examples to use context managers where appropriate.
There were also a few examples of handling HTTPError which I didn’t touch, because the whole file object versus exception object thing is probably a separate can of worms. ---------- keywords: +patch Added file: http://bugs.python.org/file38049/urlopen-with.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue12955> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com