Patchwork [evolve-ext] serveronly: replace exc.message with str(exc)

login
register
mail settings
Submitter Arun Kulshreshtha
Date March 9, 2017, 8:24 p.m.
Message ID <967b1ad8617442c46131.1489091049@dev10559.prn2.facebook.com>
Download mbox | patch
Permalink /patch/19063/
State Accepted
Headers show

Comments

Arun Kulshreshtha - March 9, 2017, 8:24 p.m.
# HG changeset patch
# User Arun Kulshreshtha <kulshrax@fb.com>
# Date 1489090827 28800
#      Thu Mar 09 12:20:27 2017 -0800
# Node ID 967b1ad8617442c46131477708068badd029904c
# Parent  7d15775d85857c13843dd1c76626293550006d81
serveronly: replace exc.message with str(exc)

BaseException.message is deprecated in Python 2.6, so use str() instead.
Pierre-Yves David - March 10, 2017, 12:41 a.m.
On 03/09/2017 12:24 PM, Arun Kulshreshtha wrote:
> # HG changeset patch
> # User Arun Kulshreshtha <kulshrax@fb.com>
> # Date 1489090827 28800
> #      Thu Mar 09 12:20:27 2017 -0800
> # Node ID 967b1ad8617442c46131477708068badd029904c
> # Parent  7d15775d85857c13843dd1c76626293550006d81
> serveronly: replace exc.message with str(exc)
>
> BaseException.message is deprecated in Python 2.6, so use str() instead.

pushed, thanks

Patch

diff --git a/hgext3rd/evolve/serveronly.py b/hgext3rd/evolve/serveronly.py
--- a/hgext3rd/evolve/serveronly.py
+++ b/hgext3rd/evolve/serveronly.py
@@ -21,7 +21,7 @@ 
         obsexchange,
     )
 except ValueError as exc:
-    if exc.message != 'Attempted relative import in non-package':
+    if str(exc) != 'Attempted relative import in non-package':
         raise
     # extension imported using direct path
     sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))