Commit b058adc5 authored by Alex Huszagh's avatar Alex Huszagh

Bug fix for boolean return using statement with internal commas.

parent ee1b0219
......@@ -84,7 +84,7 @@ static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
......@@ -402,6 +402,12 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
return PyInt_FromSize_t(ival);
}
......
# tag: cpp
from libcpp cimport bool
cdef extern from "cpp_templates_helper.h":
cdef cppclass BinaryAnd[T1, T2]:
@staticmethod
T1 call(T1 x, T2 y)
def test_compound_bool_return(bool x, bool y):
"""
>>> test_compound_bool_return(True, False)
False
"""
return BinaryAnd[bool, bool].call(x, y)
......@@ -44,3 +44,9 @@ class Div {
public:
static T half(T value) { return value / 2; }
};
template <class T1, class T2>
class BinaryAnd {
public:
static T1 call(T1 x, T2 y) { return x & y; }
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment