[Python-Dev] cpython (3.4): handle errors without a reason attribute
Benjamin Peterson
benjamin at python.org
Wed Nov 26 01:21:08 CET 2014
On Tue, Nov 25, 2014, at 19:16, Antoine Pitrou wrote:
> On Wed, 26 Nov 2014 00:06:06 +0000
> benjamin.peterson <python-checkins at python.org> wrote:
>
> > https://hg.python.org/cpython/rev/e635c3ba75c8
> > changeset: 93591:e635c3ba75c8
> > branch: 3.4
> > user: Benjamin Peterson <benjamin at python.org>
> > date: Tue Nov 25 15:43:58 2014 -0600
> > summary:
> > handle errors without a reason attribute
> >
> > files:
> > Lib/test/support/__init__.py | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> >
> > diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
> > --- a/Lib/test/support/__init__.py
> > +++ b/Lib/test/support/__init__.py
> > @@ -698,7 +698,7 @@
> > try:
> > f(*args, **kwargs)
> > except IOError as e:
> > - if e.reason == "CERTIFICATE_VERIFY_FAILED":
> > + if "CERTIFICATE_VERIFY_FAILED" in str(e):
>
> You should be able to keep the e.reason test if you only catch SSLError.
Unfortunately, test_robotparser seems to manage to raise a cert
validation error without a reason.
More information about the Python-Dev
mailing list