Message92281
In Python 2.6 if I subclass Exception and intialize my instances with a
`message` attribute, I get a DeprecationError via BaseException.
Of course there is no problem in Py3, because adding a `message`
attribute to instances of a subclass is in fact **not** a problem and
will **not** be disallowed. I.e., the DeprecationError is raised
incorrectly in Python 2.6.
I am not sure how to raise a DeprecationError *only* in the correct
cases, but certainly the current behavior can be much improved. As a
crude example, if the `args` passed to BaseException has length 0, then
a flag could be set not to raise this DeprecationError. Even if not
perfect, this would be **much** better than the current behavior, since
it is common practice not to pass the subclass's initialization
arguments on to Exception.__init__.
This behavior can be expected to affect entire libraries and therefore
should be fixed. (Eg., it affects docutils.) I.e., "change the name of
your variable" is the wrong answer to this bug report. |
|
Date |
User |
Action |
Args |
2009-09-05 16:24:54 | aisaac | set | recipients:
+ aisaac |
2009-09-05 16:24:54 | aisaac | set | messageid: <1252167894.27.0.660137723145.issue6844@psf.upfronthosting.co.za> |
2009-09-05 16:24:53 | aisaac | link | issue6844 messages |
2009-09-05 16:24:52 | aisaac | create | |
|