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.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).
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... Best Regards, Nikita Nemkin
0001-Fixed-explicit-coercion-of-ctypedef-ed-C-types.patch
Description: Binary data
_______________________________________________ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel