Sorry, I was not clear enough... if 'profile' directive is of type 'bool', but initialized to None, it seems that at some point Dag's transform machinery puts a 'False' there, so the "directives['profile'] is None" does not work as expected...
So, in short, the 'profile' directive should be 'False' by default; but if enabled, the macro in the C code should definitely default to 1, as currently done. On Thu, Sep 24, 2009 at 6:38 PM, Lisandro Dalcin <[email protected]> wrote: > Wait a minute... I think the problem is not in the C code, but it is > actually a bug in Cython ... See the patch below... > > diff -r 71980dd690eb Cython/Compiler/Nodes.py > --- a/Cython/Compiler/Nodes.py Tue Sep 22 02:13:13 2009 -0700 > +++ b/Cython/Compiler/Nodes.py Thu Sep 24 18:36:00 2009 -0300 > @@ -1062,7 +1062,7 @@ > is_getbuffer_slot = (self.entry.name == "__getbuffer__" and > self.entry.scope.is_c_class_scope) > > - if code.globalstate.directives['profile'] is None: > + if code.globalstate.directives['profile']: > profile = 'inline' not in self.modifiers and not lenv.nogil > else: > profile = code.globalstate.directives['profile'] > diff -r 71980dd690eb Cython/Compiler/Options.py > --- a/Cython/Compiler/Options.py Tue Sep 22 02:13:13 2009 -0700 > +++ b/Cython/Compiler/Options.py Thu Sep 24 18:36:00 2009 -0300 > @@ -67,7 +67,7 @@ > 'wraparound' : True, > 'c99_complex' : False, # Don't use macro wrappers for complex > arith, not sure what to name this... > 'callspec' : "", > - 'profile': None, > + 'profile': False, > } > > # Override types possibilities above, if needed > > > On Thu, Sep 24, 2009 at 5:25 PM, Robert Bradshaw > <[email protected]> wrote: >> On Sep 24, 2009, at 12:24 PM, Lisandro Dalcin wrote: >> >>> Are all you sure this should by the default ?? >>> >>> #ifndef CYTHON_TRACING >>> #define CYTHON_TRACING 1 >>> #endif >> >> No, I'm not, but I'm not sure it should be off by default either. >> Anyone else have any input? I guess I should run some more benchmarks >> at least. >> >> - Robert >> >> _______________________________________________ >> 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 > -- 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
