diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2009-03-21 01:41:27 +0300 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2009-03-21 01:41:27 +0300 |
commit | 0c7e5323e891e5b32b4bfae58115137e805adfeb (patch) | |
tree | a92d0320b3bef22e80683cf38d4b241a9e35806e /source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp | |
parent | 6ba34d18b55bedbddb750e5231a2aec9a1fbbac0 (diff) |
Improvements in error handling at Python-C++ boundaries.
Diffstat (limited to 'source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp')
-rw-r--r-- | source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp index 9f7e0359ec8..fd32430b362 100644 --- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp @@ -182,15 +182,18 @@ PyObject *BinaryPredicate1D_getName( BPy_BinaryPredicate1D *self, PyObject *args PyObject *BinaryPredicate1D___call__( BPy_BinaryPredicate1D *self, PyObject *args) { BPy_Interface1D *obj1, *obj2; - bool b; - if( !PyArg_ParseTuple(args,(char *)"OO", &obj1, &obj2) ) { - cout << "ERROR: BinaryPredicate1D___call__ " << endl; + if( !PyArg_ParseTuple(args, "O!O!", &Interface1D_Type, &obj1, &Interface1D_Type, &obj2) ) return NULL; - } - b = self->bp1D->operator()( *(obj1->if1D) , *(obj2->if1D) ); - return PyBool_from_bool( b ); + if (self->bp1D->operator()( *(obj1->if1D) , *(obj2->if1D) ) < 0) { + if (!PyErr_Occurred()) { + string msg(self->bp1D->getName() + " __call__ method failed"); + PyErr_SetString(PyExc_RuntimeError, msg.c_str()); + } + return NULL; + } + return PyBool_from_bool( self->bp1D->result ); } |