//---------------------------------------------------------------------------
-%typemap(out) bool "$result = PyBool_FromLong((bool)$1);"
+%typemap(out) bool {
+ $result = $1 ? Py_True : Py_False; Py_INCREF($result);
+}
//---------------------------------------------------------------------------