[pypy-dev] Re: [pypy-svn] r8078 - pypy/trunk/src/pypy/interpreter

Armin Rigo arigo at tunes.org
Fri Jan 7 19:09:24 CET 2005


On Fri, Jan 07, 2005 at 12:39:41PM +0100, holger krekel wrote:
> > Log:
> > changed LOAD_GLOBAL to support the flow space better.
> > In case of a NameError, where the space does not define NameError,
> > we raise a real NameError with a message.
> (...).  It seems the flow
> object space could easily provide its own w_NameError and
> then you can check the usual way, catching an OperationError and 
> then for e.match(space, space.w_NameError) without changing 
> the interpreter. 

I guess the goal is to have the problem crash the program with a meaningful
error message.  If the flow objspace provided a w_NameError, then it would
become a normal exception within the flow graph, and you would end up
compiling a program that contains an explicit "raise NameError".  In this case
it's better just to crash the flow objspace clearly.

Maybe a nicer hack than Christian's can be found for this purpose, e.g.  
setting w_NameError to a special value that would trigger an (interp-level)  
AssertionError in the constructor of OperationError -- the advantage is that
the AssertionError can provide the meaningful bit of information: the intended
message of the faulty w_NameError.

A bientot,


More information about the Pypy-dev mailing list