Patchwork sslutil: remove deprecated ex.message usage

login
register
mail settings
Submitter Durham Goode
Date July 9, 2016, 12:45 a.m.
Message ID <a7a7110867f2c90424f6.1468025140@dev8486.prn1.facebook.com>
Download mbox | patch
Permalink /patch/15778/
State Superseded
Headers show

Comments

Durham Goode - July 9, 2016, 12:45 a.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1468024931 25200
#      Fri Jul 08 17:42:11 2016 -0700
# Node ID a7a7110867f2c90424f6619f452613bff1b7757d
# Parent  b4d117cee636be8a566f56e84d4b351a736a1299
sslutil: remove deprecated ex.message usage

Python 2.6 prints a deprecration message when ex.message is used which breaks
the tests. Let's switch to str(ex) instead, which does the same thing since this
particular exception just inherits from Exception.

test-url.py is the test that uncovered this
Yuya Nishihara - July 9, 2016, 6:13 a.m.
On Fri, 8 Jul 2016 17:45:40 -0700, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham@fb.com>
> # Date 1468024931 25200
> #      Fri Jul 08 17:42:11 2016 -0700
> # Node ID a7a7110867f2c90424f6619f452613bff1b7757d
> # Parent  b4d117cee636be8a566f56e84d4b351a736a1299
> sslutil: remove deprecated ex.message usage

It's been fixed in stable, but yet merged into the default branch.

Patch

diff --git a/mercurial/sslutil.py b/mercurial/sslutil.py
--- a/mercurial/sslutil.py
+++ b/mercurial/sslutil.py
@@ -384,7 +384,7 @@  def _verifycert(cert, hostname):
                 if _dnsnamematch(value, hostname):
                     return
             except wildcarderror as e:
-                return e.message
+                return str(e)
 
             dnsnames.append(value)
 
@@ -405,7 +405,7 @@  def _verifycert(cert, hostname):
                         if _dnsnamematch(value, hostname):
                             return
                     except wildcarderror as e:
-                        return e.message
+                        return str(e)
 
                     dnsnames.append(value)