homepage

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.

classification
Title: urllib.response.addinfourl does not support __exit__
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.0, Python 3.1
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jhylton Nosy List: MLModel, jhylton
Priority: normal Keywords:

Created on 2009年03月05日 00:58 by MLModel, last changed 2022年04月11日 14:56 by admin. This issue is now closed.

Messages (2)
msg83174 - (view) Author: Mitchell Model (MLModel) Date: 2009年03月05日 00:58
response = urllib.request.open(someURL)
 page = response.read()
close() be called on response after the read(), right? Experimentation 
shows that I can repeatedly read from response until I close it, getting 
back empty bytes objects.
Thinking that anything with a close() should support the with statement, 
I tried putting the code inside one but got
 AttributeError: 'addinfourl' object has no attribute '__exit__'
so I can see that it doesn't support with. It seems like it should.
msg84225 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2009年03月26日 21:34
Makes sense to me.
Committed revision 70625.
History
Date User Action Args
2022年04月11日 14:56:46adminsetgithub: 49668
2009年03月26日 21:34:43jhyltonsetstatus: open -> closed
resolution: accepted -> fixed
messages: + msg84225
2009年03月26日 21:32:52jhyltonsetassignee: jhylton

resolution: accepted
nosy: + jhylton
2009年03月05日 00:58:39MLModelcreate

AltStyle によって変換されたページ (->オリジナル) /