[Cython] Hello

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Jan 28 17:31:35 EST 2020


On 29/01/20 1:33 am, John Skaller2 wrote:
> 
> # This conflicts with the C++ bool type, and unfortunately
> # C++ is too liberal about PyObject* <-> bool conversions,
> # resulting in unintuitive runtime behavior and segfaults.
> #    ("bool",    "PyBool_Type",     []),
> 
> Now you have me worried!  Any more
> detailed explanation of this issue?

I think it's just that the name "bool" refers to different
things in Python and C++, and trying to unify them would
lead to problems. So Cython has chosen to use "bool" to mean
the Python type, and introduced "bint" for the C++ notion
of a bool.

This is consistent with the general philosophy that
the Cython language is an extension of Python, so where
there is a conflict between Python smantics and C or C++
semantics, Python wins.

-- 
Greg



More information about the cython-devel mailing list