From: David Reiss Date: Tue, 9 Mar 2010 05:19:18 +0000 (+0000) Subject: THRIFT-475. python: Eliminate DeprecationWarning X-Git-Tag: 0.3.0~98 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=c548b3dd6312e02df04ca822157c1e41193731c9;p=common%2Fthrift.git THRIFT-475. python: Eliminate DeprecationWarning git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920661 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/py/src/Thrift.py b/lib/py/src/Thrift.py index 21d7aa4e..5f2564de 100644 --- a/lib/py/src/Thrift.py +++ b/lib/py/src/Thrift.py @@ -17,6 +17,8 @@ # under the License. # +import sys + class TType: STOP = 0 VOID = 1 @@ -53,6 +55,14 @@ 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