On Oct 28, 2008, at 8:08 AM, Lisandro Dalcin wrote:

> Rober, I had to fix your last commit about this, please review.

Thanks. I ran some tests but I guess I didn't run any that used this  
or it would have clearly broken. Should have just run the whole suite.

>
> On Tue, Oct 28, 2008 at 2:22 AM, Robert Bradshaw
> <[EMAIL PROTECTED]> wrote:
>> On Oct 27, 2008, at 5:50 PM, Jason Evans wrote:
>>
>>> Using changeset a71073d1250c of cython-devel, the following program:
>>>
>>> ----------------
>>> cdef foo():
>>>      cdef str s
>>>      s = "hello"
>>> foo()
>>> ----------------
>>>
>>> causes the following warning when linking:
>>>
>>> lyken:~> cython foo.pyx
>>> lyken:~> gcc -shared -pthread -fPIC -fwrapv -Wall -fno-strict- 
>>> aliasing
>>> -I/usr/local/python/dbg/include/python2.6 foo.c -ofoo.so
>>> foo.c: In function '__pyx_f_3foo_foo':
>>> foo.c:212: warning: implicit declaration of function
>>> 'PyStr_CheckExact'
>>>
>>> and the following error when importing the resulting module:
>>>
>>> lyken:~> /usr/local/python/dbg/bin/python
>>> Python 2.6 (r26:66714, Oct 21 2008, 10:58:37)
>>> [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
>>> Type "help", "copyright", "credits" or "license" for more  
>>> information.
>>>>>> import foo
>>> Traceback (most recent call last):
>>>    File "<stdin>", line 1, in <module>
>>> ImportError: ./foo.so: undefined symbol: PyStr_CheckExact
>>> [26355 refs]
>>>>>>
>>>
>>> I've seen Cython generate similar bogus calls to PyStr_CheckExact
>>> several times today while coding, but in other cases I was able to
>>> make
>>> the problem go away by adding type specifications so that
>>> everything was
>>> clearly a str.  In this case, it looks like the compiler doesn't
>>> realize
>>> that "hello" is a str (nor does it recognize str("hello") as a str).
>>>
>>> So, I think there are two problems:
>>>
>>> 1) Cython doesn't recognize string literals as str.
>>>
>>> 2) PyStr_CheckExact doesn't exist, at least for Python 2.6.  It does
>>> have PyString_CheckExact though.
>>
>> Looks like it was (2), from Python 2.2+. Thanks for the fix.
>>
>> - 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
> _______________________________________________
> Cython-dev mailing list
> [email protected]
> http://codespeak.net/mailman/listinfo/cython-dev

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

Reply via email to