New submission from Claudiu Popa:

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.

----------
components: Distutils
files: distutils.patch
keywords: patch
messages: 220705
nosy: Claudiu.Popa, dstufft, eric.araujo
priority: normal
severity: normal
status: open
title: distutils.upload uses the wrong order of exceptions
type: behavior
versions: Python 3.5
Added file: http://bugs.python.org/file35653/distutils.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21776>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to