diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2002-06-03 16:53:00 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2002-06-03 16:53:00 (GMT) |
commit | 40bbae3b03cfd33bd43cb330c48b83412463f9f1 (patch) | |
tree | 2f95d0d8d1da1744937011a2c69b0be1368b9d24 /Lib/ihooks.py | |
parent | 65230a2de758fbde57b3893c402436ae0202ada3 (diff) | |
download | cpython-40bbae3b03cfd33bd43cb330c48b83412463f9f1.zip cpython-40bbae3b03cfd33bd43cb330c48b83412463f9f1.tar.gz cpython-40bbae3b03cfd33bd43cb330c48b83412463f9f1.tar.bz2 |
Fix HTTPError __init__ for cases where fp is None.
The HTTPError class tries to act as a regular response objects for
HTTP protocol errors that include full responses. If the failure is
more basic, like no valid response, the __init__ choked when it tried
to initialize its superclasses in addinfourl hierarchy that requires a
valid response.
The solution isn't elegant but seems to be effective. Do not
initialize the base classes if there isn't a file object containing
the response. In this case, user code expecting to use the addinfourl
methods will fail; but it was going to fail anyway.
It might be cleaner to factor out HTTPError into two classes, only one
of which inherits from addinfourl. Not sure that the extra complexity
would lead to any improved functionality, though.
Partial fix for SF bug # 563665.
Bug fix candidate for 2.1 and 2.2.
Diffstat (limited to 'Lib/ihooks.py')
0 files changed, 0 insertions, 0 deletions