[Cython] Two minor bugs
nikita at nemkin.ru
Sat Mar 2 07:52:44 CET 2013
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
2. This recently added code does not compile with MSVC:
Interleaving declarations and statements is not allowed in C90...
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2293 bytes
Desc: not available
More information about the cython-devel