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.

Author orsenthil
Recipients eric.araujo, mcjeff, orsenthil
Date 2011-06-20.08:10:19
SpamBayes Score 0.0021079436
Marked as misclassified No
Message-id <1308557420.03.0.87595786668.issue12365@psf.upfronthosting.co.za>
In-reply-to
Content
well, urlopen does return an file like object for socket connection which closes itself when it goes out of scope, as you raised this bug, I think a more explicit context manager like behavior can be tried. But I am afraid that it would complex to implement with the module than it sounds.

I see some example illustrated like this:
http://stackoverflow.com/questions/1522636/should-i-call-close-after-urllib-urlopen

import contextlib

with contextlib.closing(urllib.urlopen(u)) as x:
   ...use x at will here...


But it would be good to have this ticket as a feature request open.
History
Date User Action Args
2011-06-20 08:10:20orsenthilsetrecipients: + orsenthil, eric.araujo, mcjeff
2011-06-20 08:10:20orsenthilsetmessageid: <1308557420.03.0.87595786668.issue12365@psf.upfronthosting.co.za>
2011-06-20 08:10:19orsenthillinkissue12365 messages
2011-06-20 08:10:19orsenthilcreate