[pypy-dev] DLS paper on RPython

Antonio Cuni anto.cuni at gmail.com
Thu May 17 20:34:33 CEST 2007


[I respond only to you because I don't think Massimo and Davide are 
interested in such details; I'm also cc-ing pypy-dev]

Niko Matsakis wrote:
> Ok.  I'll look at that some.  I may have to rewrite my section on 
> exceptions to describe the type-wrapping solution; I wrote it to 
> describe the newer system I started to checked in today, but then I 
> found that RPython allows any object, not just Exceptions, to be thrown, 
> meaning that this newer system won't work as well as I thought (and so 
> is currently disabled).

Probably the simplest way to solve the problem is not to allow arbitrary 
objects to be thrown in RPython; I quick grep inside objspace/std and 
interpret didn't show any case in which this feature is used, and in any 
case it should be very easy to patch.

Else, you could special-case the raise/except when using subclasses of 
Exception, and don't do the wrapping in those cases; of course you would 
have to be careful when catching all the exceptions, something like this:

try:
     foo()
except:
     bar()

needs to be translated to:

try {
     foo()
}
catch(Exception e) { // this is __builtin__.Exception
     bar()
}
catch(ExceptionWrapper e) {
     bar()
}

or something similar.

I think we should really try to avoid ExceptionWrapper beacuse it's both 
ugly and probably veeery slow.

ciao Anto



More information about the Pypy-dev mailing list