diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2009-03-30 01:50:10 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2009-03-30 01:50:10 +0400 |
commit | a377b74638245f8eb1a956c9840e16a448de553e (patch) | |
tree | f9d9197211b89561069bf887de764468924ab9e7 /source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp | |
parent | fbd92e985ed5bf19a92839b4b3fec9a93ce6519f (diff) |
Improvements on error handling in the Python API.
Diffstat (limited to 'source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp')
-rw-r--r-- | source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp index d20fbeab1ec..e61179eb901 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp @@ -105,9 +105,12 @@ int CalligraphicShader___init__( BPy_CalligraphicShader* self, PyObject *args) PyObject *obj3 = 0, *obj4 = 0; - if(!( PyArg_ParseTuple(args, "ddOO", &d1, &d2, &obj3, &obj4) - && PyList_Check(obj3) && PyList_Size(obj3) > 1 && PyBool_Check(obj4) )) { - cout << "ERROR: CalligraphicShader___init__" << endl; + if(!( PyArg_ParseTuple(args, "ddO!O!", &d1, &d2, &PyList_Type, &obj3, &PyBool_Type, &obj4) )) + return -1; + if( PyList_Size(obj3) != 2 ) { + stringstream msg("CalligraphicShader() accepts a list of 2 elements ("); + msg << PyList_Size(obj3) << " found)"; + PyErr_SetString(PyExc_TypeError, msg.str().c_str()); return -1; } |