[issue9041] raised exception is misleading

Pauli Rikula report at bugs.python.org
Wed Feb 8 10:27:53 CET 2012


Pauli Rikula <pauli.rikula at gmail.com> added the comment:

Could we overcome these issues by some kind of exception inheritance?

On Tue, Aug 30, 2011 at 5:28 PM, Meador Inge <report at bugs.python.org> wrote:
>
> Meador Inge <meadori at gmail.com> added the comment:
>
> That is a good question.  While it is true that errors other than 'PyExc_OverflowError', will be mapped onto a 'TypeError' I don't think that is a bad thing.  Any errors that come out of 'PyFloat_AsDouble' should be handled on a case-by-case basis and not blindly passed back out the call chain.  Otherwise, we may end up passing back errors (which are who knows what) that make sense for a caller of 'PyFloat_AsDouble', but not for callers of 'g_set'.
>
> Also, the interface would become variable, meaning that whenever 'PyFloat_AsDouble' introduces new exceptions, then this code would too, which would lead to a somewhat unpredictable interface for callers of 'g_set'.
>
> ----------
>
> _______________________________________
> Python tracker <report at bugs.python.org>
> <http://bugs.python.org/issue9041>
> _______________________________________

----------

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


More information about the Python-bugs-list mailing list