[pypy-dev] Re: [pypy-svn] r8078 - pypy/trunk/src/pypy/interpreter
tismer at stackless.com
Sun Jan 9 23:21:42 CET 2005
Armin Rigo wrote:
> On Fri, Jan 07, 2005 at 12:39:41PM +0100, holger krekel wrote:
>>>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
No, I tried that in the last sprint, but Armin hit my
fingers and said "no no, we *want* to crash here!",
which is correct. So I thought to crash with a useful
> 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.
Exactly. An errorof this kind is usually a bug in the
source code, and actually I found one in _formatting.
> 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.
Sure, there are better ways.
For me, having the real name error instead of a simple
crash was extremely helpful, because I finally wanted
to get that translation out of the door. :-)
But don't allow a NameError, because that is a violation
of the flow space's contract: Global names are constants
and must exist.
ciao - chris
Christian Tismer :^) <mailto:tismer at stackless.com>
tismerysoft GmbH : Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9A : *Starship* http://starship.python.net/
14109 Berlin : PGP key -> http://wwwkeys.pgp.net/
work +49 30 802 86 56 mobile +49 173 24 18 776 fax +49 30 80 90 57 05
PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04
whom do you want to sponsor today? http://www.stackless.com/
More information about the Pypy-dev