You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by dc...@apache.org on 2019/12/10 22:13:43 UTC

[thrift] 02/02: Revert "Remove unnecessary TException.message hack"

This is an automated email from the ASF dual-hosted git repository.

dcelasun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git

commit 3d9f50d61728d377951f9b6df5f19196f6b3af46
Author: D. Can Celasun <ca...@dcc.im>
AuthorDate: Tue Dec 10 22:13:19 2019 +0000

    Revert "Remove unnecessary TException.message hack"
    
    This reverts commit 45a9827f0f455d377ae87d9a35349c10181d6893.
---
 lib/py/src/Thrift.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/py/src/Thrift.py b/lib/py/src/Thrift.py
index b335bc1..c390cbb 100644
--- a/lib/py/src/Thrift.py
+++ b/lib/py/src/Thrift.py
@@ -90,6 +90,15 @@ class TProcessor(object):
 class TException(Exception):
     """Base class for all thrift exceptions."""
 
+    # BaseException.message is deprecated in Python v[2.6,3.0)
+    if (2, 6, 0) <= sys.version_info < (3, 0):
+        def _get_message(self):
+            return self._message
+
+        def _set_message(self, message):
+            self._message = message
+        message = property(_get_message, _set_message)
+
     def __init__(self, message=None):
         Exception.__init__(self, message)
         self.message = message