mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 02:45:22 +00:00
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:
parent
ffb97e105c
commit
45a9827f0f
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user