[Cython] Bug: bad C code generated for (some) "... and ... or ..." expressions

2012-06-07 Thread Dieter Maurer
"cython 0.13" generates bad C code for the attached "pyx" file. "cython" itself recognizes that it did something wrong and emits ";" to the generated file: ... static __pyx_t_12cybug_and_or_pointer __pyx_f_12cybug_and_or_bug(PyObject *__pyx_v_o) { __pyx_t_12cybug_and_or_pointer __pyx_r; int

[Cython] Why does "__cinit__" insists on converting its arguments to Python objects?

2012-06-07 Thread Dieter Maurer
The following cython source leads to a "Cannot convert 'pointer' to Python object". ctypedef void * pointer cdef extern from "nonexistant.h": cdef pointer to_pointer(object) cdef class C: cdef pointer p def __cinit__(self, pointer p): self.p = p c = C(to_pointer(None)) Why does the con

Re: [Cython] Bug: bad C code generated for (some) "... and ... or ..." expressions

2012-06-08 Thread Dieter Maurer
Stefan Behnel wrote at 2012-6-8 08:50 +0200: >thanks for the report. > >Dieter Maurer, 07.06.2012 10:44: >> "cython 0.13" generates bad C code for the attached "pyx" file. > >Could you try the latest release? I would at least expect an error instead

[Cython] Feature request: generate signature information for use by "inspect"

2012-06-28 Thread Dieter Maurer
Python's "inspect" module is a great help to get valuable information about a package. Many higher level tools (e.g. the "help" builtin and "pydoc") are based on it. I have just recognized a deficiency of "cython" generated modules with respect to "inspect" support: "inspect" cannot determin

Re: [Cython] Feature request: generate signature information for use by "inspect"

2012-06-28 Thread Dieter Maurer
Stefan Behnel wrote at 2012-6-28 09:25 +0200: >Dieter Maurer, 28.06.2012 09:04: >> ... >> In this case, I suggest to enhance the >> function's docstring by signature information. >> >> I now transform ma

[Cython] Potential bug: hole in "C <-> Python" conversion

2012-06-29 Thread Dieter Maurer
I have cdef extern from *: ctypedef char const_unsigned_char "const unsigned char" cdef const_unsigned_char *c_data = data leads to "Cannot convert Python object to 'const_unsigned_char *'" while "cdef char *c_data = data" works. Should the "ctypedef char const_unsigned_char" not ensure

Re: [Cython] Potential bug: hole in "C <-> Python" conversion

2012-06-29 Thread Dieter Maurer
Stefan Behnel wrote at 2012-6-29 11:42 +0200: >Dieter Maurer, 29.06.2012 11:25: >> I have >> >> cdef extern from *: >> ctypedef char const_unsigned_char "const unsigned char" > >This is an incorrect declaration. "char" != "unsig