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

Niko Matsakis niko at alum.mit.edu
Fri May 18 11:14:22 CEST 2007

> 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.

Okay, I guess the right thing to do then is to insert a CHECKCAST  
when the static type of a thrown exception is not a sub-type of  
Exception.  "Correct" RPython should work, and the rest will throw a  

If the annotator/rtyper were later changed to provide a static type  
better than Object, then the casts won't be generated.

That's what I've done for now.  It fixes the broken test, at least. :)


More information about the Pypy-dev mailing list