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:
authorCampbell Barton <ideasman42@gmail.com>2007-07-12 15:51:21 +0400
committerCampbell Barton <ideasman42@gmail.com>2007-07-12 15:51:21 +0400
commitbfb9603cb47e524439d76f1ec303423b8ab8e9c3 (patch)
treef56bb85b85e262d918c7938073f98c0b6cb3ea9c /source/blender/python/api2_2x/BezTriple.c
parente7c15b97e24c1923df8bef96ac35f9abd17c7964 (diff)
From stable
Revision: 11237 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11237 Author: campbellbarton Date: 2007-07-12 13:05:31 +0200 (Thu, 12 Jul 2007) Log Message: ----------- PyObject_IsTrue was missing a check for an error return value in many cases.
Diffstat (limited to 'source/blender/python/api2_2x/BezTriple.c')
-rw-r--r--source/blender/python/api2_2x/BezTriple.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/source/blender/python/api2_2x/BezTriple.c b/source/blender/python/api2_2x/BezTriple.c
index 200f8ceb34e..2aa908ff2b0 100644
--- a/source/blender/python/api2_2x/BezTriple.c
+++ b/source/blender/python/api2_2x/BezTriple.c
@@ -350,7 +350,12 @@ static PyObject *BezTriple_getHide( BPy_BezTriple * self )
static int BezTriple_setHide( BPy_BezTriple * self, PyObject *value )
{
- if( PyObject_IsTrue( value ) )
+ int param = PyObject_IsTrue( value );
+ if( param == -1 )
+ return EXPP_ReturnIntError( PyExc_TypeError,
+ "expected True/False or 0/1" );
+
+ if( param )
self->beztriple->hide = IPO_BEZ;
else
self->beztriple->hide = 0;
@@ -368,6 +373,7 @@ static int BezTriple_setSelects( BPy_BezTriple * self, PyObject *args )
{
struct BezTriple *bezt = self->beztriple;
PyObject *ob1, *ob2, *ob3;
+ int param1, param2, param3;
/* only accept a sequence of three booleans */
@@ -379,15 +385,22 @@ static int BezTriple_setSelects( BPy_BezTriple * self, PyObject *args )
ob2 = PySequence_ITEM( args, 1 );
ob3 = PySequence_ITEM( args, 2 );
+ param1 = PyObject_IsTrue( ob1 );
+ param2 = PyObject_IsTrue( ob2 );
+ param3 = PyObject_IsTrue( ob3 );
+
+ if (param1==-1 || param2==-1 || param3==-1)
+ return EXPP_ReturnIntError( PyExc_TypeError,
+ "expected a sequence of 3 items: True/False or 0/1" );
+
/* assign the selects */
- bezt->f1 = ( char )PyObject_IsTrue( ob1 );
- bezt->f2 = ( char )PyObject_IsTrue( ob2 );
- bezt->f3 = ( char )PyObject_IsTrue( ob3 );
+ bezt->f1 = (char)param1;
+ bezt->f2 = (char)param2;
+ bezt->f3 = (char)param3;
Py_DECREF( ob1 );
Py_DECREF( ob2 );
Py_DECREF( ob3 );
-
return 0;
}