[pypy-dev] small problem with return values

Carl Friedrich Bolz cfbolz at gmx.de
Thu Mar 16 15:08:36 CET 2006

Hi Christian!

Armin Rigo wrote:
> 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.)

It is actually the replace_gc_(un)protect code that you wrote. The 
problem is that you replace an operation

v0 = gc_unprotect(obj)

with no operation. That means that afterwards v0 is undefined. For some 
reason the checkgraph in the gctransformer was removed at one point (I 
thought there was one there), so you found this problem only _much_ 
later in the backend optimizations. This is not entirely your fault, the 
problem is indeed that gctransformer is a mess, you should not have to 
care for generating a

v0 = same_as(Constant(None, Void))

yourself. The transformer definitively needs some refactoring.


Carl Friedrich

More information about the Pypy-dev mailing list