This look nicer. However, there is still something that does not work. Try to compile the following:
cdef object foo1 cdef object foo2 = [] and then you will see that the declaration of the (unused) 'foo1' is not ever emited in the module declaration part. Some optimization should be playing games. Or perhaps 'foo1' should be completely ignored and never declared/initialized/cleaned-up? On Wed, Oct 15, 2008 at 3:13 PM, Dag Sverre Seljebotn <[EMAIL PROTECTED]> wrote: > Dag Sverre Seljebotn wrote: >> Lisandro Dalcin wrote: >>> Well, what I do not like about your patch is that the cdef module >>> globals are not initialized to 'None' in the module init function. And >>> this is a bit unsafe, Cython almost always assumes that PyObect* >>> pointers are not-NULL. I can imagine some code breaking with your >>> patch. >>> >> >> Indeed, it is unsafe. Very much so, I just created a crashing testcase :-) > > OK, my last attempt is up as a new patch on the ticket: > > <http://trac.cython.org/cython_trac/ticket/90> > > It works in this way: Assignment nodes which are created from cdef > statements in the module scope doesn't get the "first" attribute set to > True (as it is not guaranteed that the cdef statement is indeed the > first assignment, indeed they are implicitly always set to None first). > > I now realize what made my worry about your patch: It works ok, but it > corrects something which was set wrongly in the first place. This should > fix the root cause instead. > > -- > Dag Sverre > _______________________________________________ > Cython-dev mailing list > [email protected] > http://codespeak.net/mailman/listinfo/cython-dev > -- 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
