[issue6844] BaseException DeprecationError raises inappropriately

Georg Brandl report at bugs.python.org
Wed Sep 16 21:20:23 CEST 2009


Georg Brandl <georg at python.org> added the comment:

The patch leads to crashes with all the exceptions that have their own
structs; since they are derived from BaseException they must start with
the same binary layout as PyBaseExceptionObject (pointers to any
exception will be cast to PyBaseExceptionObject).

This also shows one way in which this change can mess up third-party
extensions (though I don't know if anybody does that): if some extension
created new exception classes doing it the way we do, e.g. for SyntaxError.

However, I have a different suggestion: we could put a user-set
"message" in the __dict__.  The getter would then check for that first
and only warn if it falls back to self->message. See attached patch.

----------
Added file: http://bugs.python.org/file14901/exception-message-fix-2.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6844>
_______________________________________


More information about the Python-bugs-list mailing list