Deprecate BaseException.message as per PEP 352.

This commit is contained in:
Brett Cannon 2007-05-05 01:34:02 +00:00
parent 2ebc4d8054
commit 229cee2d3d
7 changed files with 147 additions and 68 deletions

View file

@ -106,6 +106,21 @@ MAX_INTERPOLATION_DEPTH = 10
class Error(Exception):
"""Base class for ConfigParser exceptions."""
def _get_message(self):
"""Getter for 'message'; needed only to override deprecation in
BaseException."""
return self.__message
def _set_message(self, value):
"""Setter for 'message'; needed only to override deprecation in
BaseException."""
self.__message = value
# BaseException.message has been deprecated since Python 2.6. To prevent
# DeprecationWarning from popping up over this pre-existing attribute, use
# a new property that takes lookup precedence.
message = property(_get_message, _set_message)
def __init__(self, msg=''):
self.message = msg
Exception.__init__(self, msg)