[pypy-dev] stuck with translation error

wlavrijsen at lbl.gov wlavrijsen at lbl.gov
Fri Jul 1 20:04:19 CEST 2011


Hi Amaury,

>> [v1 = call_args((function free), ((1, ('flavor', 'track_... False)), v0, ('raw'), (False)), v2 = simple_call((type error), ('out of resources'))]
>
> Hm, it can also be the next operation: v2 = simple_call((type error),
> ('out of resources'))

I was under the impression that that was a standard error, but then again
that would have been for malloc(), not free(). I searched again and came
up with is code in ll_thread.py:

def allocate_ll_lock():
     # track_allocation=False here; be careful to lltype.free() it.  The
     # reason it is set to False is that we get it from all app-level
     # lock objects, as well as from the GIL, which exists at shutdown.
     ll_lock = lltype.malloc(TLOCKP.TO, flavor='raw', track_allocation=False)
     res = c_thread_lock_init(ll_lock)
     if rffi.cast(lltype.Signed, res) <= 0:
         lltype.free(ll_lock, flavor='raw', track_allocation=False)
         raise error("out of resources")
     return ll_lock

which looks very much like it (the link to the exit is a raise). So I think
that it isn't my code that doesn't translate. :)

Beats me then, why it would bite me.

> What is this "error" object? Some local exception class?

I can look again in a half an hour: I had just restarted the translation
after a removing some of my recent changes. But I'll bet it's what I see
here above in allocate_ll_lock. The module ll_thread.py defines:

class error(Exception):
     pass

Thanks,
      Wim
-- 
WLavrijsen at lbl.gov    --    +1 (510) 486 6411    --    www.lavrijsen.net


More information about the pypy-dev mailing list