Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2009-03-21 01:41:27 +0300
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2009-03-21 01:41:27 +0300
commit0c7e5323e891e5b32b4bfae58115137e805adfeb (patch)
treea92d0320b3bef22e80683cf38d4b241a9e35806e /source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp
parent6ba34d18b55bedbddb750e5231a2aec9a1fbbac0 (diff)
Improvements in error handling at Python-C++ boundaries.
Diffstat (limited to 'source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp')
-rw-r--r--source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp
index bcd98a42189..e9892825d50 100644
--- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp
+++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp
@@ -153,15 +153,18 @@ PyObject * BinaryPredicate0D_getName( BPy_BinaryPredicate0D *self, PyObject *arg
PyObject * BinaryPredicate0D___call__( BPy_BinaryPredicate0D *self, PyObject *args)
{
BPy_Interface0D *obj1, *obj2;
- bool b;
- if( !PyArg_ParseTuple(args,(char *)"OO", &obj1, &obj2) ) {
- cout << "ERROR: BinaryPredicate0D___call__ " << endl;
+ if( !PyArg_ParseTuple(args, "O!O!", &Interface0D_Type, &obj1, &Interface0D_Type, &obj2) )
return NULL;
- }
- b = self->bp0D->operator()( *(obj1->if0D) , *(obj2->if0D) );
- return PyBool_from_bool( b );
+ if (self->bp0D->operator()( *(obj1->if0D) , *(obj2->if0D) ) < 0) {
+ if (!PyErr_Occurred()) {
+ string msg(self->bp0D->getName() + " __call__ method failed");
+ PyErr_SetString(PyExc_RuntimeError, msg.c_str());
+ }
+ return NULL;
+ }
+ return PyBool_from_bool( self->bp0D->result );
}