On Fri, Mar 1, 2013 at 10:52 PM, Nikita Nemkin <nik...@nemkin.ru> wrote: > Hi, > > 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 > __getattr__). > Patch+test case and attached.
Thanks! Applied. > Interestingly, implicit casts use a different code path and are not > affected. > > There is potential for similar bugs in the future, because __getattr__ > delegation is inherently brittle in the presence of the base class > (BaseType). Yes, very true. > 2. This recently added code does not compile with MSVC: > > https://github.com/cython/cython/blob/master/Cython/Utility/TypeConversion.c#L140-142 > Interleaving declarations and statements is not allowed in C90... Fixed https://github.com/cython/cython/commit/24f56e14194e14c706beb6d0ee58a58e77b0b03e - Robert _______________________________________________ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel