[PATCH] sslutil: remove deprecated ex.message usage

Durham Goode durham at fb.com
Sat Jul 9 00:45:40 UTC 2016


# HG changeset patch
# User Durham Goode <durham at 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

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)
 


More information about the Mercurial-devel mailing list