[pypy-dev] small problem with return values

Armin Rigo arigo at tunes.org
Thu Mar 16 14:41:26 CET 2006


Hi,

On Thu, Mar 16, 2006 at 01:26:28PM +0100, Armin Rigo wrote:
> def rtype_destruct_object(hop):
>     v_any, = hop.inputargs(hop.args_r[0])
>     hop.genop('gc_unprotect', [v_any])

Updates (with feedback from Carl): the compute_result_annotation also
needs fixing.  It should not say "annmodel.s_None", but just "None" --
which however must then be spelled in a lambda form, to avoid confusion
with "unspecified".  Argh, this interface is not really polished.  You
need:
    
     ..., compute_result_annotation=lambda *args_s: None, ...

Carl is hitting more bugs, which are not in backend_optimizations but in
the gctransformer which you run before -- he just added a checkgraph()
there that shows this.  This needs fixing, indeed.  (gctransform in
general needs to be cleaned up, too.)

Note that I'm not sure exactly what the annotator does if you do "def
g(): return f()"  where f() is declared with lambda *args_s: None.  I am
fearing something along the lines of: f()'s result get
SomeImpossibleValue; then "return f()" will send SomeImpossibleValue to
the parent, which then thinks that g() cannot return a normal value and
thus must always raise an exception.  This would certainly cause much
confusion.  I'm afraid for now the answer is "don't do that then".


A bientot,

Armin



More information about the Pypy-dev mailing list