[Cython] Two minor bugs
robertwb at gmail.com
Sun Mar 3 08:45:53 CET 2013
On Fri, Mar 1, 2013 at 10:52 PM, Nikita Nemkin <nikita at nemkin.ru> wrote:
> I'm new to this list and to Cython internals.
> Reporting two recently found bugs:
> 1. Explicit <bytes> cast fails unexpectedly:
> ctypedef char* LPSTR
> cdef LPSTR c_str = b"ascii"
> <bytes>c_str # Failure: Python objects cannot be cast from pointers
> of primitive types
> The problem is CTypedefType not delegating can_coerce_to_pyobject() to
> the original type.
> (because BaseType.can_coerce_to_pyobject takes precedence over
> Patch+test case and attached.
> Interestingly, implicit casts use a different code path and are not
> There is potential for similar bugs in the future, because __getattr__
> delegation is inherently brittle in the presence of the base class
Yes, very true.
> 2. This recently added code does not compile with MSVC:
> Interleaving declarations and statements is not allowed in C90...
More information about the cython-devel