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_UnaryPredicate0D.cpp
parent6ba34d18b55bedbddb750e5231a2aec9a1fbbac0 (diff)
Improvements in error handling at Python-C++ boundaries.
Diffstat (limited to 'source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp')
-rw-r--r--source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp
index f751d092920..19d4a8abdbf 100644
--- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp
+++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp
@@ -165,19 +165,24 @@ PyObject * UnaryPredicate0D___call__( BPy_UnaryPredicate0D *self, PyObject *args
{
PyObject *py_if0D_it;
- if(!( PyArg_ParseTuple(args, "O", &py_if0D_it) && BPy_Interface0DIterator_Check(py_if0D_it) )) {
- cout << "ERROR: UnaryPredicate0D___call__ " << endl;
+ if( !PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &py_if0D_it) )
return NULL;
- }
Interface0DIterator *if0D_it = ((BPy_Interface0DIterator *) py_if0D_it)->if0D_it;
- if( if0D_it )
- return PyBool_from_bool( self->up0D->operator()(*if0D_it) );
- else
- cerr << "ERROR: UnaryPredicate0D___call__ (no Interface0DIterator)" << endl;
-
- Py_RETURN_NONE;
+ if( !if0D_it ) {
+ string msg(self->up0D->getName() + " has no Interface0DIterator");
+ PyErr_SetString(PyExc_RuntimeError, msg.c_str());
+ return NULL;
+ }
+ if (self->up0D->operator()(*if0D_it) < 0) {
+ if (!PyErr_Occurred()) {
+ string msg(self->up0D->getName() + " __call__ method failed");
+ PyErr_SetString(PyExc_RuntimeError, msg.c_str());
+ }
+ return NULL;
+ }
+ return PyBool_from_bool( self->up0D->result );
}