On Sep 15, 2008, at 4:22 PM, Simon King wrote:

>
> Dear Robert,
>
> simply for testing, i raise an error as soon as the init-method of my
> class is called. So, for the moment the code looks like this:
> class COHO:
>     """
>     Docstring
>     """
>     def __init__(self, *args, **kwds):
>         raise ValueError, "fooBAR..."
>         # followed by a lots of more code
>
>
> And now the reason why i am puzzled.
> If i write a .pyx file with the above content, then everything is fine
> (i.e., an error is raised, but no crash occurs). But with my module
> (although the relevant (?) part of it has exactly the above form), it
> fails:
> sage: from cohomology import *
> sage: H=COHO()
> /home/king/SAGE/devel/sage-3.1.1/local/bin/sage-sage: line 216: 27343
> Speicherzugriffsfehler  sage-ipython "$@" -c "$SAGE_STARTUP_COMMAND;"
>
> Note that my class also has a __del__ method.
> Could that be the reason for the "Speicherzugriffsfehler" (what is it
> in english?)?
> I mean, would __del__ be called if __init__ fails?

No idea what Speicherzugriffsfehler means (never heard of that  
before) but __del__ might be called on a failing __init__.

For Cython, you might want to use __cinit__ and __dealloc__ (which  
are guaranteed to be called exactly once in pairs).

- Robert


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to