Robert, about this commit...

changeset:   1774:7dd195513552
user:        Robert Bradshaw <[email protected]>
date:        Wed Feb 25 12:25:16 2009 -0800
summary:     Avoid crashes in refnanny when PyFinalize gets messy,
Sage now exits cleanly.

Could you point me to the pieces of Cython code where you had these
problems at Py_Finalize() ?

I'm fine with the patch, but IMHO correct usage of atexit module or
Py_AtExit() should not need the precautions you took.

1) Python functions registered with atexit module are called before
any cleanup. Moreover, Py_IsInitialized() should return true on any of
them.

2) C functions registered with Py_AtExit() are called when all Python
state has gone. Then, they should be pure C functions, no Python C-API
calls or Python objects involved. The only safe way for you to ensure
this is to declare them using 'nogil'. And in such case, the code in
not refnanny managed...

Any chance that some code in Sage does not takes (2) into account??

-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to