[Cython] cython doesn't compile cdef'd variables of type set?

Dag Sverre Seljebotn dagss at student.matnat.uio.no
Thu Oct 2 22:58:47 CEST 2008


didier deshommes wrote:
> On Thu, Oct 2, 2008 at 2:40 PM, Lisandro Dalcin <dalcinl at gmail.com> wrote:
>> Please, clarify my something: At wich stage the syntax error is shown
>> for Python 2.3? Do you mean the C compiler fails? Or is Cython
>> failing?
>>
> 
> Cython fails with a syntax error on "cdef set s". As an aside, if you
> have this in py2.3:
> 
> """
> #py 2.3
> cdef object s
> s =set()
> """
> 
> Everything will compile fine but the module will fail to load when you
> try to import it with this message:
> "undefined symbol: PySet_Type". That's because Symtab.py assumes that
> sets are available in py2.3 also, and includes it in `builtin_entries`
> (a dict).Should we work around that or should we let users shoot
> themselves in the foot?

My five cents: I'm -1 on making emulating later Python versions in 
earlier ones in most cases, and definitely this one. We are developing 
Cython for the present and future, and Python 2.3 is starting to belong 
to the past.

The Cython compiler should run under Python 2.3 and create Python 
2.3-compatible code, but that is different from backporting builtins 
like "set".

-- 
Dag Sverre


More information about the Cython-dev mailing list