[pypy-dev] Throwing arbitrary objects as exceptions (was Re: DLS paper on RPython)
pedronis at openendsystems.com
Fri May 18 10:29:02 CEST 2007
Niko Matsakis wrote:
> I guess the question is whether people consider the ability to throw
> arbitrary objects (rather than only those whose type is a subtype of
> Exception) a feature or a bug.
> I'm on the fence myself: it makes translating to the jvm and clr
> easier if we prohibit arbitrary objects, and it seems like a marginal
> use-case, but on the other hand, well, Python can do it, so why not?
the idea is that only subclasses of Exception/BaseException can be
thrown in RPython, we have no code
to enforce that right now OTOH if you find places in our RPython code
that don't do that those
are bugs to fix.
> If anyone wanted to give me a few pointers as to what has to be
> changed to force exceptions to be subtypes of Exception, I'd be
> excited to try hacking it, just so I can learn more about that part
> of PyPy.
> On the other hand, I think that a hybrid wrapping strategy could
> actually work reasonably well and avoid wrapping in the 99% of cases
> where Exception sub-types are thrown and caught.
> Therefore, I'd say the real question is how people on the list think
> that RPython "ought" to behave.
> pypy-dev at codespeak.net
More information about the Pypy-dev