Author Claudiu.Popa
Recipients Claudiu.Popa, dstufft, eric.araujo
Date 2014-06-16.09:33:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1402911209.04.0.940354382674.issue21776@psf.upfronthosting.co.za>
In-reply-to
Content
Hi. Currently, distutils.command.upload has this code:

try:
    result = urlopen(request)
    status = result.getcode()
    reason = result.msg
except OSError as e:
    self.announce(str(e), log.ERROR)
    return
except HTTPError as e:
    status = e.code
    reason = e.msg

This is wrong because HTTPError is a subclass of OSError and OSError branch will be chosen in case HTTPError is raised. The HTTPError branch was added in 4373f0e4eb21, but after a while socket.error became an alias for OSError, as well for HTTPError. This patch also adds a `return` in order to prevent an UnboundLocalError (found in issue10367 as well), but it can be removed if other solutions are preferable.
History
Date User Action Args
2014-06-16 09:33:29Claudiu.Popasetrecipients: + Claudiu.Popa, eric.araujo, dstufft
2014-06-16 09:33:29Claudiu.Popasetmessageid: <1402911209.04.0.940354382674.issue21776@psf.upfronthosting.co.za>
2014-06-16 09:33:28Claudiu.Popalinkissue21776 messages
2014-06-16 09:33:28Claudiu.Popacreate