<p dir="ltr">If cinit fails half way through you still may need to do some cleanup, hence dealloc which must be aware of this.</p>
<div class="gmail_quote">On Oct 5, 2015 7:12 AM, "Jeroen Demeyer" <<a href="mailto:jdemeyer@cage.ugent.be">jdemeyer@cage.ugent.be</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
I'm not entirely sure if this is a feature or bug...<br>
<br>
I noticed that, if a __cinit__ call raises an exception on an object, that __dealloc__ on that same object is still called.<br>
<br>
The problem is that __cinit__ is supposed to set up the C-level attributes for that object. If this somehow fails, then the object isn't in a consistent state yet, so it makes no sense to call __dealloc__ on it.<br>
<br>
Do you consider this a Cython bug or should I manually protect my code against this?<br>
<br>
<br>
Thanks,<br>
Jeroen.<br>
_______________________________________________<br>
cython-devel mailing list<br>
<a href="mailto:cython-devel@python.org" target="_blank">cython-devel@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/cython-devel" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/cython-devel</a><br>
</blockquote></div>