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
--
wlavrij...@lbl.gov    --    +1 (510) 486 6411    --    www.lavrijsen.net
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
http://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to