Stefan Behnel wrote:
> Lisandro Dalcin, 25.03.2010 19:43:
>   
>> On 25 March 2010 06:17, Stefan Behnel wrote:
>>     
>>> ... and which then lead to a reproducible, GC related crash in Hudson:
>>>
>>> Doctest: closure_tests_4.__test__.g1923 (line 205) ... python:
>>> Modules/gcmodule.c:277: visit_decref: Assertion `gc->gc.gc_refs != 0' 
>>> failed.
>>>
>>>       
>> BTW, I've previously commented on something related to this ... In
>> CPython, classes defining  __del__() are not GC'ed, because __del__
>> can invoke arbitrary Python code... However, this is not the case for
>> Cython's __dealloc__ ...  Am I missing something?
>>     
>
> Well, yes, there is a difference. Python code can only do Python operations 
> for cleanup, so this can lead to all sorts of complications. On the other 
> hand, C code can run any kind of safe C operations, and this is often 
> required for timely memory cleanup in wrapper code.
>
> The special __dealloc__ method serves the latter purpose. Although it 
> certainly is not hard to write crashing code in __dealloc__, it's rather 
> unlikely that someone does so a) on purpose or b) without recognising it 
> somewhat soon due to a crash.
>   
Would __dealloc__ be implied "nogil" (that is, as in the signature, not 
as in "with nogil") solve anything which isn't already solved? Or is 
that already the case?

Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to