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: urllib2.HTTPError broken due to urllib.addinfourl changes
Type: Stage:
Components: Library (Lib) Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: djc, georg.brandl, gpolo
Priority: normal Keywords: patch

Created on 2008-04-08 15:19 by djc, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
urllib2_2585.diff gpolo, 2008-04-09 15:09
Messages (3)
msg65168 - (view) Author: Dirkjan Ochtman (djc) * (Python committer) Date: 2008-04-08 15:19
djc@enrai tests $ python2.6
Python 2.6a2+ (trunk, Apr  4 2008, 20:21:45)
[GCC 4.1.2 20070214 (  (gdc 0.24, using dmd 1.020)) (Gentoo 4.1.2
p1.0.2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib2
>>> try:
...     urllib2.urlopen('http://example.com/weird')
... except urllib2.HTTPError, inst:
...     print inst.code
...
None
>>>

urllib.addinfourl.__init__() was changed in r60133 to set self.code.
Unfortunately, this overrides HTTPError.code, which is probably not good.
msg65239 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2008-04-09 15:09
It seems the fix is just passing code to addinfourl __init__, not sure
if someone forgot this or this is just totally wrong.

Patch added.
msg65248 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-04-09 17:58
Thanks Guilherme, that is indeed a detail that I forgot. Fixed in r62246.
History
Date User Action Args
2022-04-11 14:56:33adminsetgithub: 46837
2008-04-09 17:58:06georg.brandlsetstatus: open -> closed
resolution: fixed
messages: + msg65248
2008-04-09 15:09:49gpolosetfiles: + urllib2_2585.diff
nosy: + gpolo
messages: + msg65239
keywords: + patch
2008-04-08 20:35:13djcsetnosy: + georg.brandl, - birkenfeld
2008-04-08 15:19:24djccreate