[Cython] cython --cplus --embed generates invalid code

2014-11-30 Thread Michael Enßlin
Hi, on my system, --embed does not work with --cplus. How to reproduce: Any valid pyx file works: $ rm -f test.pyx; touch test.pyx $ cython --embed --cplus test.pyx $ g++ -c test.cpp -I/usr/include/python3.4m test.cpp: In function ‘wchar_t* __Pyx_char2wchar(char*)’: test.cpp:945:41: error: inval

[Cython] Cython produces invalid C code

2015-04-22 Thread Michael Enßlin
Hi everybody, Cython 0.21.1, from Debian Sid, and Cython 0.22, from Gentoo, produce invalid C Code for the following .pyx file: $ cat test.pyx cimport cpython cdef extern from "test.h": cdef void foo(int i = 0) def bar(self): foo(0) $ cat test.h void foo(int i); $ cython test.py

Re: [Cython] Cython produces invalid C code

2015-04-22 Thread Michael Enßlin
Hi, On 23/04/15 06:25, Robert Bradshaw wrote: > I've made this an explicit error. thanks; I hope this will save future users some WTFs. ~mic_e signature.asc Description: OpenPGP digital signature ___ cython-devel mailing list cython-devel@python

[Cython] Misleading error message when assigning function pointers with differing except* declarations

2015-05-07 Thread Michael Enßlin
Hi, consider the following example: $ cat demo.pyx cdef void (*foo)() cdef void bar() except*: pass foo = bar $ cython demo.pyx Error compiling Cython file: ... cdef void (*foo)() cdef void bar() except*: pass foo = bar

[Cython] Cython generates invalid C code for some generator expressions in cdef functions

2015-05-08 Thread Michael Enßlin
Take the following example: $ cat t2.pyx cdef void read_callback(): foo = b"asdf" bar = (c for c in foo) $ cython t2.pyx $ gcc -I/usr/include/python3.4m t2.c t2.c: In function ‘__pyx_f_2t2_read_callback’: t2.c:778:12: error: ‘None’ undeclared (first use in this function) return

[Cython] Feature request: Expose methods to fake stack traces

2015-06-08 Thread Michael Enßlin
Hi everybody, my C++ exceptions contain some stack trace information (starting with __FILE__ and __LINE__), and I'd like to preserve that information in my custom 'except+' translator. Cython seems to have some internal methods to fake Python stack trace objects, but research (and an unanswered q

[Cython] Cython produces invalid code for operator()

2015-06-11 Thread Michael Enßlin
Hi guys, have a look at this: $ cat bar.pyx cdef extern from "foo.h": cdef cppclass Foo: int operator() (int arg) int do_call (int arg) cdef int bar(int arg): cdef Foo foo foo.do_call(arg) return foo(arg) $ cython3 --cplus bar.pyx $ cat bar.cpp (...) static in

[Cython] Compiler crash in AnalyseExpressionsTransform

2015-06-12 Thread Michael Enßlin
Hi, another bug report: mic@mic /tmp $ cat t11.pyx cdef cppclass foo: pass def test(): foo() mic@mic /tmp $ cython --cplus t11.pyx Error compiling Cython file: ... cdef cppclass foo: pass def test(): foo() ^

[Cython] Can't call functions with multi-token template arguments such as 'char *'

2015-06-12 Thread Michael Enßlin
Hi, it seems to be impossible to use anything but a single word as a template type for functions. Classes don't suffer from this issue, as seen below. As a workaround, complex types can be ctypedef-d to a single word (also seen below). $ cat t10.pyx cdef extern from "nope.h": cdef cppclass

[Cython] Feature request: Flag to enable warnings when 'extern' functions are not declared 'except +'

2015-06-12 Thread Michael Enßlin
Hi everybody, as you surely have guessed from the amount of Bug reports I have recently submitted to this mailing list, I'm currently working on a rather large Cython project. More precisely: I'm using Cython as the glue layer between the Python and C++ components of openage; an overview and sourc

[Cython] Feature Request: Variadic Templates

2015-06-21 Thread Michael Enßlin
Hi, I'd like to see support for variadic template arguments, such as this: test.h: template RetT foo(VARARGS ...); test.pyx: cdef extern from "test.h": cdef RetT foo[RetT, ... VARARGS](... VARARGS) def test(): cdef int i = foo[int, float, int](1, 2.5, 3) This would allow Cy

Re: [Cython] Multidimensional indexing of C++ objects

2015-07-04 Thread Michael Enßlin
Drawback 1) could be solved by declaring the operator as cdef inline operator []() instead of cdef inline __getitem__() signature.asc Description: OpenPGP digital signature ___ cython-devel mailing list cython-devel@python.org https://mail.p