Comment 1 for bug 110143

Revision history for this message
Alexander Belchenko (bialix) wrote : Re: [Bug 110143] using 'message' in a BzrError format string results in unprintable exceptions

Robert Collins пишет:
> Public bug reported:
>
> BzrError formats the _fmt using self.__dict__.
>
> However, self.message does not appear in self.__dict__ because its
> handled by a data descriptor in BaseException.
>
> We might be able to fix this with some python innards voodoo, but for
> now, just documenting that its bad and correcting our usage of 'message'
> in the format strings is sufficient.
>
> BzrCheckError, WeaveError, are broken.
>
> e.g.
>>>> str(errors.BzrCheckError('foo'))
> "Unprintable exception BzrCheckError: dict={'_preformatted_string':
> None}, fmt='Internal check failed: %(message)s',
> error=KeyError('message',)"
>
> affects /products/bzr
> status confirmed
> importance high

This issue exist in Python 2.5, because in 2.5 exceptions now new-style classes,
and 'messages' listed in __slots__. For LockError I recently changed 'message' to 'msg'.
I think we need to change and other places too.