Index: boost/python/object_operators.hpp =================================================================== --- boost/python/object_operators.hpp (revision 55665) +++ boost/python/object_operators.hpp (working copy) @@ -60,7 +60,9 @@ object_operators::operator bool_type() const { object_cref2 x = *static_cast(this); - return PyObject_IsTrue(x.ptr()) ? &object::ptr : 0; + int res = PyObject_IsTrue(x.ptr()); + if (res < 0) throw error_already_set(); + else return res ? &object::ptr : 0; } template @@ -68,7 +70,9 @@ object_operators::operator!() const { object_cref2 x = *static_cast(this); - return !PyObject_IsTrue(x.ptr()); + int res = PyObject_IsTrue(x.ptr()); + if (res < 0) throw error_already_set(); + else return res == 1; } # define BOOST_PYTHON_COMPARE_OP(op, opid) \