stuck with translation error
Hi, ran into this error, which I haven't seen before and which I can't pin down: [translation:ERROR] File "/home/wlav/pypydev/pypy/pypy/rpython/rtyper.py", line 254, in specialize_more_blocks [translation:ERROR] self.specialize_block(block) [translation:ERROR] File "/home/wlav/pypydev/pypy/pypy/rpython/rtyper.py", line 406, in specialize_block [translation:ERROR] self.translate_hl_to_ll(hop, varmapping) [translation:ERROR] File "/home/wlav/pypydev/pypy/pypy/rpython/rtyper.py", line 535, in translate_hl_to_ll [translation:ERROR] resultvar = hop.dispatch() [translation:ERROR] File "/home/wlav/pypydev/pypy/pypy/rpython/rtyper.py", line 768, in dispatch [translation:ERROR] return translate_meth(self) [translation:ERROR] File "<487-codegen /home/wlav/pypydev/pypy/pypy/rpython/rtyper.py:610>", line 4, in translate_op_simple_call [translation:ERROR] return r_arg1.rtype_simple_call(hop) [translation:ERROR] File "/home/wlav/pypydev/pypy/pypy/rpython/rpbc.py", line 723, in rtype_simple_call [translation:ERROR] return self.redispatch_call(hop, call_args=False) [translation:ERROR] File "/home/wlav/pypydev/pypy/pypy/rpython/rpbc.py", line 772, in redispatch_call [translation:ERROR] assert hop.nb_args == 1, ("arguments passed to __init__, " [translation:ERROR] AssertionError: arguments passed to __init__, but no __init__! I don't find anything that could be related to local code, until I go up to specialize_block. That block has: (Pdb+) block.operations [v1 = call_args((function free), ((1, ('flavor', 'track_... False)), v0, ('raw'), (False)), v2 = simple_call((type error), ('out of resources'))] which I presume is lltype.free() of which I have a few calls, but no recent changes (and I don't understand the complaint about __init__ at that point). I'm going to roll back history to see where things broke, but if the above rings a bell with someone, that could spare me some time ... Thanks! Cheers, Wim -- WLavrijsen@lbl.gov -- +1 (510) 486 6411 -- www.lavrijsen.net
Hi, 2011/7/1 <wlavrijsen@lbl.gov>:
[translation:ERROR] File "/home/wlav/pypydev/pypy/pypy/rpython/rtyper.py", line 254, in specialize_more_blocks [translation:ERROR] self.specialize_block(block) [translation:ERROR] File "/home/wlav/pypydev/pypy/pypy/rpython/rtyper.py", line 406, in specialize_block [translation:ERROR] self.translate_hl_to_ll(hop, varmapping) [translation:ERROR] File "/home/wlav/pypydev/pypy/pypy/rpython/rtyper.py", line 535, in translate_hl_to_ll [translation:ERROR] resultvar = hop.dispatch() [translation:ERROR] File "/home/wlav/pypydev/pypy/pypy/rpython/rtyper.py", line 768, in dispatch [translation:ERROR] return translate_meth(self) [translation:ERROR] File "<487-codegen /home/wlav/pypydev/pypy/pypy/rpython/rtyper.py:610>", line 4, in translate_op_simple_call [translation:ERROR] return r_arg1.rtype_simple_call(hop) [translation:ERROR] File "/home/wlav/pypydev/pypy/pypy/rpython/rpbc.py", line 723, in rtype_simple_call [translation:ERROR] return self.redispatch_call(hop, call_args=False) [translation:ERROR] File "/home/wlav/pypydev/pypy/pypy/rpython/rpbc.py", line 772, in redispatch_call [translation:ERROR] assert hop.nb_args == 1, ("arguments passed to __init__, " [translation:ERROR] AssertionError: arguments passed to __init__, but no __init__!
I don't find anything that could be related to local code, until I go up to specialize_block. That block has:
(Pdb+) block.operations [v1 = call_args((function free), ((1, ('flavor', 'track_... False)), v0, ('raw'), (False)), v2 = simple_call((type error), ('out of resources'))]
which I presume is lltype.free() of which I have a few calls, but no recent changes (and I don't understand the complaint about __init__ at that point).
I'm going to roll back history to see where things broke, but if the above rings a bell with someone, that could spare me some time ... Thanks!
Hm, it can also be the next operation: v2 = simple_call((type error), ('out of resources')) What is this "error" object? Some local exception class? -- Amaury Forgeot d'Arc
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@lbl.gov -- +1 (510) 486 6411 -- www.lavrijsen.net
Hi,
[translation:ERROR] File "<487-codegen /home/wlav/pypydev/pypy/pypy/rpython/rtyper.py:610>", line 4, in translate_op_simple_call [translation:ERROR] return r_arg1.rtype_simple_call(hop) [translation:ERROR] File "/home/wlav/pypydev/pypy/pypy/rpython/rpbc.py", line 723, in rtype_simple_call [translation:ERROR] return self.redispatch_call(hop, call_args=False) [translation:ERROR] File "/home/wlav/pypydev/pypy/pypy/rpython/rpbc.py", line 772, in redispatch_call [translation:ERROR] assert hop.nb_args == 1, ("arguments passed to __init__, " [translation:ERROR] AssertionError: arguments passed to __init__, but no __init__!
got it, and funnily enough it even had something to do with an __init__ (but that wasn't the actual cause). I had some code to raise an exception in init if an attempt was made to instantiate an abstract C++ class. In that code, I did: except Exception, e: if e.match(self.space, self.space.w_AttributeError): whereas it should have been: except OperationError, e: if e.match(self.space, self.space.w_AttributeError): the point being that the code changes an AttributeError (failure to find a suitable method, i.e. a usable C++ constructor) into a TypeError (stating that the class is abstract). I'm actually surprised that the bad code made it past the rtyper, given that class Exception does not actually have a match() method. Either way, I don't think I deserved such a horrible error message for such a little coding mistake. :} But there's a good deal of irony here in that the code that caused the horrible error message on me is there to make an error in user code more clear. Best regards, Wim -- WLavrijsen@lbl.gov -- +1 (510) 486 6411 -- www.lavrijsen.net
participants (2)
-
Amaury Forgeot d'Arc
-
wlavrijsen@lbl.gov