From 46be73387c7f5ef67990d64b2a90868ffc359f2e Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Sun, 23 Aug 2009 21:22:52 +0000 Subject: [PATCH] boost/python/object_operators.hpp: merging trunk rev. 55708 into release branch [SVN r55742] --- include/boost/python/object_operators.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/boost/python/object_operators.hpp b/include/boost/python/object_operators.hpp index f27f88f8..d436bb01 100644 --- a/include/boost/python/object_operators.hpp +++ b/include/boost/python/object_operators.hpp @@ -60,7 +60,9 @@ inline object_operators::operator bool_type() const { object_cref2 x = *static_cast(this); - return PyObject_IsTrue(x.ptr()) ? &object::ptr : 0; + int is_true = PyObject_IsTrue(x.ptr()); + if (is_true < 0) throw_error_already_set(); + return is_true ? &object::ptr : 0; } template @@ -68,7 +70,9 @@ inline bool object_operators::operator!() const { object_cref2 x = *static_cast(this); - return !PyObject_IsTrue(x.ptr()); + int is_true = PyObject_IsTrue(x.ptr()); + if (is_true < 0) throw_error_already_set(); + return !is_true; } # define BOOST_PYTHON_COMPARE_OP(op, opid) \