[Cython] GCC, warning ‘__Pyx_Print’ defined but not used (Python 2.X)

Robert Bradshaw robertwb at math.washington.edu
Fri Mar 6 22:09:18 CET 2009


On Mar 6, 2009, at 12:56 PM, Lisandro Dalcin wrote:

> On Fri, Mar 6, 2009 at 6:29 PM, Robert Bradshaw
> <robertwb at math.washington.edu> wrote:
>> On Mar 6, 2009, at 12:20 PM, Lisandro Dalcin wrote:
>>> Robert, I believe some times we complicate implementations too much
>>> for the sake of optimization... :-)
>>
>> This was motivated by some code where printing was the dominant step
>> in the runtime. Unfortunately, PySys_GetObject((char *)"stdout")
>> (which must be called every time) still takes some time.
>>
>
> Mmm.. Are you sure that's the only cause? Every thing you need to
> print involve calls to PyObject_Repr, and they involve creating string
> objetcs... I would never expect that 'print' could run fast retaining
> its generality...

Well, I was printing strings.

> Anyway, I've pushed a fix calling __Pyx_Print() after return... Well,
> other compilers (Intel) would warn about unreachable code... Anyway
> Cython generates a lot of unreachable code :-) ... some day far in the
> future....

Yeah, there's a lot of unreachable code. The logic to not output  
unreachable code may exceed disk space saved...it's an optimization  
that so far I've been happy to leave to the C compiler.

- Robert



More information about the Cython-dev mailing list