[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11135] branches/pyapi_devel/source/ blender/python/api2_2x: replaced type checking of ints/floats/ strings with checks that dont exclude subclasses or subtypes

Campbell Barton cbarton at metavr.com
Sun Jul 1 05:53:03 CEST 2007


Revision: 11135
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11135
Author:   campbellbarton
Date:     2007-07-01 05:53:02 +0200 (Sun, 01 Jul 2007)

Log Message:
-----------
replaced type checking of ints/floats/strings with checks that dont exclude subclasses or subtypes

Modified Paths:
--------------
    branches/pyapi_devel/source/blender/python/api2_2x/BezTriple.c
    branches/pyapi_devel/source/blender/python/api2_2x/Constraint.c
    branches/pyapi_devel/source/blender/python/api2_2x/Group.c
    branches/pyapi_devel/source/blender/python/api2_2x/Ipo.c
    branches/pyapi_devel/source/blender/python/api2_2x/Ipocurve.c
    branches/pyapi_devel/source/blender/python/api2_2x/Lamp.c
    branches/pyapi_devel/source/blender/python/api2_2x/Mesh.c
    branches/pyapi_devel/source/blender/python/api2_2x/Metaball.c
    branches/pyapi_devel/source/blender/python/api2_2x/Modifier.c
    branches/pyapi_devel/source/blender/python/api2_2x/Object.c
    branches/pyapi_devel/source/blender/python/api2_2x/Scene.c
    branches/pyapi_devel/source/blender/python/api2_2x/Texture.c
    branches/pyapi_devel/source/blender/python/api2_2x/World.c
    branches/pyapi_devel/source/blender/python/api2_2x/gen_utils.c
    branches/pyapi_devel/source/blender/python/api2_2x/sceneRender.c
    branches/pyapi_devel/source/blender/python/api2_2x/sceneSequence.c

Modified: branches/pyapi_devel/source/blender/python/api2_2x/BezTriple.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/BezTriple.c	2007-06-30 21:32:24 UTC (rev 11134)
+++ branches/pyapi_devel/source/blender/python/api2_2x/BezTriple.c	2007-07-01 03:53:02 UTC (rev 11135)
@@ -413,7 +413,7 @@
 	ob1 = PySequence_ITEM( args, 0 );
 	ob2 = PySequence_ITEM( args, 1 );
 
-	if( !PyInt_CheckExact( ob1 ) || !PyInt_CheckExact( ob2 ) ) {
+	if( !PyInt_Check( ob1 ) || !PyInt_Check( ob2 ) ) {
 		Py_DECREF( ob1 );
 		Py_DECREF( ob2 );
 		return EXPP_ReturnIntError( PyExc_TypeError,

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Constraint.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Constraint.c	2007-06-30 21:32:24 UTC (rev 11134)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Constraint.c	2007-07-01 03:53:02 UTC (rev 11135)
@@ -1401,7 +1401,7 @@
 {
 	int setting;
 
-	if( !PyInt_CheckExact( key ) )
+	if( !PyInt_Check( key ) )
 		return EXPP_ReturnPyObjError( PyExc_TypeError,
 				"expected an int arg" );
 

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Group.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Group.c	2007-06-30 21:32:24 UTC (rev 11134)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Group.c	2007-07-01 03:53:02 UTC (rev 11135)
@@ -203,7 +203,7 @@
 	
 	GROUP_DEL_CHECK_INT(self);
 	
-	if( !PyInt_CheckExact( value ) )
+	if( !PyInt_Check( value ) )
 		return EXPP_ReturnIntError( PyExc_TypeError,
 			"expected an integer (bitmask) as argument" );
 	

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Ipo.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Ipo.c	2007-06-30 21:32:24 UTC (rev 11134)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Ipo.c	2007-07-01 03:53:02 UTC (rev 11135)
@@ -804,7 +804,7 @@
 
 static int Ipo_setBlocktype( BPy_Ipo * self, PyObject * value )
 {
-	if( !PyInt_CheckExact( value ) )
+	if( !PyInt_Check( value ) )
 		return EXPP_ReturnIntError( PyExc_TypeError,
 				"expected int argument" );
 

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Ipocurve.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Ipocurve.c	2007-06-30 21:32:24 UTC (rev 11134)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Ipocurve.c	2007-07-01 03:53:02 UTC (rev 11135)
@@ -796,12 +796,14 @@
 	0: disabled
 	1: enabled (object)
 	2: enabled (python expression)
+	
+	TODO - Python expression
 */
 static int IpoCurve_setDriver( C_IpoCurve * self, PyObject * args )
 {
 	IpoCurve *ipo = self->ipocurve;
 	int type;
-	if( !PyInt_CheckExact( args ) )
+	if( !PyInt_Check( args ) )
 		return EXPP_ReturnIntError( PyExc_TypeError,
 				"expected int argument 0 or 1 " );
 	
@@ -884,7 +886,7 @@
 		return EXPP_ReturnIntError( PyExc_RuntimeError,
 				"This IpoCurve does not have an active driver" );
 
-	if( !PyInt_CheckExact( args ) )
+	if( !PyInt_Check( args ) )
 		return EXPP_ReturnIntError( PyExc_TypeError,
 				"expected int argument" );
 

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Lamp.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Lamp.c	2007-06-30 21:32:24 UTC (rev 11134)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Lamp.c	2007-07-01 03:53:02 UTC (rev 11135)
@@ -837,7 +837,7 @@
 				| EXPP_LAMP_MODE_NOSPECULAR
 				| EXPP_LAMP_MODE_SHAD_RAY;
 
-	if( !PyInt_CheckExact ( value ) ) {
+	if( !PyInt_Check( value ) ) {
 		char errstr[128];
 		sprintf ( errstr , "expected int bitmask of 0x%04x", bitmask );
 		return EXPP_ReturnIntError( PyExc_TypeError, errstr );

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Mesh.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Mesh.c	2007-06-30 21:32:24 UTC (rev 11134)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Mesh.c	2007-07-01 03:53:02 UTC (rev 11135)
@@ -1439,15 +1439,15 @@
 			return EXPP_ReturnPyObjError( PyExc_ValueError,
 					"error, maximum name length is 31" );
 		
-		if(PyInt_CheckExact(val)){ 
+		if(PyInt_Check(val)){ 
 			type = CD_PROP_INT;
 			i = (int)PyInt_AS_LONG(val);
 		}
-		else if(PyFloat_CheckExact(val)){
+		else if(PyFloat_Check(val)){
 			type = CD_PROP_FLT;
 			f = (float)PyFloat_AsDouble(val);
 		}
-		else if(PyString_CheckExact(val)){
+		else if(PyString_Check(val)){
 			type = CD_PROP_STR;
 			s = PyString_AsString(val);
 		}
@@ -2185,7 +2185,7 @@
 						"MVert belongs to a different mesh" );
 			}
 			index = ((BPy_MVert*)tmp)->index;
-		} else if( PyInt_CheckExact( tmp ) ) {
+		} else if( PyInt_Check( tmp ) ) {
 			index = PyInt_AsLong ( tmp );
 		} else {
 			MEM_freeN( vert_table );
@@ -3148,7 +3148,7 @@
 			ok = 0; 
 			for( j = 0; ok == 0 && j < nverts; ++j ) {
 				PyObject *item = PySequence_ITEM( tmp, j );
-				if( !PyInt_CheckExact( item ) )
+				if( !PyInt_Check( item ) )
 					ok = 1;
 				else {
 					int index = PyInt_AsLong ( item );
@@ -3384,7 +3384,7 @@
 		PyObject *tmp = PySequence_GetItem( args, i );
 		if( BPy_MEdge_Check( tmp ) )
 			edge_table[i] = ((BPy_MEdge *)tmp)->index;
-		else if( PyInt_CheckExact( tmp ) )
+		else if( PyInt_Check( tmp ) )
 			edge_table[i] = PyInt_AsLong ( tmp );
 		else {
 			MEM_freeN( edge_table );
@@ -3596,7 +3596,7 @@
 		tmp1 = PySequence_GetItem( tmp, 0 );
 		tmp2 = PySequence_GetItem( tmp, 1 );
 		Py_DECREF( tmp );
-		if( !(BPy_MEdge_Check( tmp1 ) || PyInt_CheckExact( tmp1 )) ||
+		if( !(BPy_MEdge_Check( tmp1 ) || PyInt_Check( tmp1 )) ||
 				!VectorObject_Check ( tmp2 ) ) {
 			MEM_freeN( edge_table );
 			MEM_freeN( vert_list );
@@ -3608,7 +3608,7 @@
 		}
 
 		/* store edge index, new vertex location */
-		if( PyInt_CheckExact( tmp1 ) )
+		if( PyInt_Check( tmp1 ) )
 			edge_table[i] = PyInt_AsLong ( tmp1 );
 		else
 			edge_table[i] = ((BPy_MEdge *)tmp1)->index;
@@ -4428,7 +4428,7 @@
 	mask = TF_SEL1;
 	for( i=0; i<length; ++i, mask <<= 1 ) {
 		PyObject *tmp = PySequence_GetItem( value, i ); /* adds a reference, remove below */
-		if( !PyInt_CheckExact( tmp ) ) {
+		if( !PyInt_Check( tmp ) ) {
 			Py_DECREF(tmp);
 			return EXPP_ReturnIntError( PyExc_TypeError,
 					"expected a tuple of integers" );
@@ -5476,7 +5476,7 @@
 		PyObject *tmp = PySequence_GetItem( args, i );
 		if( BPy_MFace_Check( tmp ) )
 			face_table[i] = ((BPy_MFace *)tmp)->index;
-		else if( PyInt_CheckExact( tmp ) )
+		else if( PyInt_Check( tmp ) )
 			face_table[i] = PyInt_AsLong( tmp );
 		else {
 			MEM_freeN( face_table );
@@ -6059,7 +6059,7 @@
 			}
 			index1 = v1->index;
 			index2 = v2->index;
-		} else if( PyInt_CheckExact( v1 ) && PyInt_CheckExact( v2 ) ) {
+		} else if( PyInt_Check( v1 ) && PyInt_Check( v2 ) ) {
 			index1 = PyInt_AsLong( (PyObject *)v1 );
 			index2 = PyInt_AsLong( (PyObject *)v2 );
 			if( (int)index1 >= mesh->totvert
@@ -6232,7 +6232,6 @@
 		self->mesh->key->from = (ID *)self->mesh;
 	
 	
-	
 	/* Copy materials to new object */
 	switch (ob->type) {
 	case OB_SURF:
@@ -7141,7 +7140,7 @@
 static int Mesh_setMultires( BPy_Mesh * self, PyObject *value, void *type )
 {
 	int i;
-	if( !PyInt_CheckExact( value ) )
+	if( !PyInt_Check( value ) )
 		return EXPP_ReturnIntError( PyExc_TypeError,
 					"expected integer argument" );
 	
@@ -7832,7 +7831,7 @@
 
 	/* if param isn't an int, error */
 
-	if( !PyInt_CheckExact( value ) )
+	if( !PyInt_Check( value ) )
 		return EXPP_ReturnIntError( PyExc_TypeError,
 				"expected an int argument" );
 

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Metaball.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Metaball.c	2007-06-30 21:32:24 UTC (rev 11134)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Metaball.c	2007-07-01 03:53:02 UTC (rev 11135)
@@ -509,7 +509,7 @@
 {
 
 	int param;
-	if( !PyInt_CheckExact( value ) )
+	if( !PyInt_Check( value ) )
 		return EXPP_ReturnIntError( PyExc_TypeError,
 					"metaball.update - expected an int argument" );
 
@@ -609,7 +609,7 @@
 {
 
 	int type;
-	if( !PyInt_CheckExact( value ) )
+	if( !PyInt_Check( value ) )
 		return EXPP_ReturnIntError( PyExc_TypeError,
 			"metaelem.type - expected an integer (bitmask) as argument" );
 	

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Modifier.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Modifier.c	2007-06-30 21:32:24 UTC (rev 11134)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Modifier.c	2007-07-01 03:53:02 UTC (rev 11135)
@@ -987,7 +987,7 @@
 {
 	int setting;
 
-	if( !PyInt_CheckExact( key ) )
+	if( !PyInt_Check( key ) )
 		return EXPP_ReturnPyObjError( PyExc_TypeError,
 				"expected an int arg as stored in Blender.Modifier.Settings" );
 

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Object.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Object.c	2007-06-30 21:32:24 UTC (rev 11134)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Object.c	2007-07-01 03:53:02 UTC (rev 11135)
@@ -2919,7 +2919,7 @@
 	struct Object *object = self->object;
 	int min, max, size;
 
-	if( !PyInt_CheckExact( value ) )
+	if( !PyInt_Check( value ) )
 		return EXPP_ReturnIntError( PyExc_TypeError,
 					"expected integer argument" );
 
@@ -3483,7 +3483,7 @@
 	int layers = 0, local;
 	Base *base;
 
-	if( !PyInt_CheckExact( value ) )
+	if( !PyInt_Check( value ) )
 		return EXPP_ReturnIntError( PyExc_TypeError,
 			"expected an integer (bitmask) as argument" );
 

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Scene.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Scene.c	2007-06-30 21:32:24 UTC (rev 11134)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Scene.c	2007-07-01 03:53:02 UTC (rev 11135)
@@ -162,7 +162,7 @@
 	
 	SCENE_DEL_CHECK_INT(self);
 	
-	if (!PyInt_CheckExact(value)) {
+	if (!PyInt_Check(value)) {
 		return EXPP_ReturnIntError( PyExc_AttributeError,
 			"expected an integer (bitmask) as argument" );
 	}


@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list