Remove unnecessary TException.message hack

Thrift attempts to work-around the Python 2.7 DeprecationWarning
around `BaseException.message` by using a property.  This hack is
unnecessary since `message` is _also_ written as a regular attribute in
the `TException` constructor (and would be in any of its children),
hence the `BaseException_get_message()` wouldn't even be called.

This hack also stands in the way of making exception instances
immutable (which is a prerequisute to fixing THRIFT-4002).
This commit is contained in:
Elvis Pranskevichus 2019-03-07 12:18:59 -05:00 committed by D. Can Celasun
parent ffb97e105c
commit 45a9827f0f
No known key found for this signature in database
GPG Key ID: FA03860D7B4C3986

View File

@ -90,15 +90,6 @@ 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