[Cython] error with cimport python_version

Case Vanhorsen casevh at gmail.com
Mon Jan 19 08:22:31 CET 2009


I'm probably doing something wrong, but I'm getting an error when I
try to compile the following:

cimport python_version


print hex(python_version.PY_VERSION_HEX)


The error message is:

using Cython
running build_ext
cythoning test.pyx to test.c

Error converting Pyrex file to C:
------------------------------------------------------------
...
    #    0xA (alpha)
    #    0xB (beta)
    #    0xC (release candidate)
    #    0xF (final)

    char[] PY_VERSION
       ^
------------------------------------------------------------

/usr/local/lib/python2.6/site-packages/Cython/Includes/python_version.pxd:31:8:
Buffer types only allowed as function local variables

Error converting Pyrex file to C:
------------------------------------------------------------
...
    #    0xB (beta)
    #    0xC (release candidate)
    #    0xF (final)

    char[] PY_VERSION
    char[] PY_PATCHLEVEL_REVISION
       ^
------------------------------------------------------------

/usr/local/lib/python2.6/site-packages/Cython/Includes/python_version.pxd:32:8:
Buffer types only allowed as function local variables

If I comment out the last two lines of python_version, it does compile
properly and I get the correct hex value. I tried both 0.10.3 and
cython-devel.

Suggestions?

Case


More information about the Cython-dev mailing list