[pypy-dev] Throwing arbitrary objects as exceptions (was Re: DLS paper on RPython)

Niko Matsakis niko at alum.mit.edu
Thu May 17 22:07:12 CEST 2007

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?

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.


More information about the Pypy-dev mailing list