Ticket #3356: patch
File patch, 893 bytes (added by , 13 years ago) |
---|
-
boost/python/object_operators.hpp
60 60 object_operators<U>::operator bool_type() const 61 61 { 62 62 object_cref2 x = *static_cast<U const*>(this); 63 return PyObject_IsTrue(x.ptr()) ? &object::ptr : 0; 63 int res = PyObject_IsTrue(x.ptr()); 64 if (res < 0) throw error_already_set(); 65 else return res ? &object::ptr : 0; 64 66 } 65 67 66 68 template <class U> … … 68 70 object_operators<U>::operator!() const 69 71 { 70 72 object_cref2 x = *static_cast<U const*>(this); 71 return !PyObject_IsTrue(x.ptr()); 73 int res = PyObject_IsTrue(x.ptr()); 74 if (res < 0) throw error_already_set(); 75 else return res == 1; 72 76 } 73 77 74 78 # define BOOST_PYTHON_COMPARE_OP(op, opid) \