[pypy-dev] Magic problems
arigo at tunes.org
Tue May 10 11:57:47 CEST 2005
On Tue, May 10, 2005 at 04:32:19AM +0200, Christian Tismer wrote:
> I discovered, that when testall.py ../*dunno*/test_geninterp.py
> is run, the generated code does not expose any exception
Not sure what you are referring to here. test_geninterp.py contains
tests that use try:except:, and check that they are really called.
Althought it was broken in the past few days (at least at one point it
failed because it was out of sync with your new simpliciations), it
works fine now.
> This is probably due to the fact that some magic module
> makes all exceptions into AssertionError subclasses.
We do strange magic things with AssertionError, but definitely not that
> You can try this by writing a small function call, which usually
> should expose at least one simple exception outlet.
> It won't, but becomes a straight sequence of simple blocks.
I think that what you are referring to is that a function like this:
will have a flow graph which is just a sequence of simple_call's,
without any exceptional branch. It has always been so: the two calling
operations, simple_call and call_args, are always allowed to raise any
exception. If there is no explicit handler in the flow graph it just
means that the exception will pass through the current function to its
parent unhandled, unmodified. We are, in other words, keeping our
graphs simpler by avoiding to stick a "catch-anything" branch pointing
to a "re-raise-it-directly" exit after every simple_call and call_args.
Anyway, if the target language supports exceptions natively (e.g. as in
geninterp.py), you don't want this catch-and-reraise step everywhere.
Of course, for the examples below you get the expected "catch-all" flow
graph exception handler:
def f(x): def f(x):
More information about the Pypy-dev