[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11136] trunk/blender/source/blender/ python/api2_2x: replace PyInt_CheckExact with PyInt_Check, same for floats and strings so subclass and C/subtypes work.

Campbell Barton cbarton at metavr.com
Sun Jul 1 07:41:23 CEST 2007


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

Log Message:
-----------
replace PyInt_CheckExact with PyInt_Check, same for floats and strings so subclass and C/subtypes work.

was reported as a bug a while ago.

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

Modified: trunk/blender/source/blender/python/api2_2x/BezTriple.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/BezTriple.c	2007-07-01 03:53:02 UTC (rev 11135)
+++ trunk/blender/source/blender/python/api2_2x/BezTriple.c	2007-07-01 05:41:23 UTC (rev 11136)
@@ -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: trunk/blender/source/blender/python/api2_2x/Camera.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Camera.c	2007-07-01 03:53:02 UTC (rev 11135)
+++ trunk/blender/source/blender/python/api2_2x/Camera.c	2007-07-01 05:41:23 UTC (rev 11136)
@@ -652,7 +652,7 @@
 {
 	unsigned int flag = 0;
 	
-	if( !PyInt_CheckExact( value ) )
+	if( !PyInt_Check( value ) )
 		return EXPP_ReturnIntError( PyExc_TypeError,
 			"expected an integer (bitmask) as argument" );
 	

Modified: trunk/blender/source/blender/python/api2_2x/Constraint.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Constraint.c	2007-07-01 03:53:02 UTC (rev 11135)
+++ trunk/blender/source/blender/python/api2_2x/Constraint.c	2007-07-01 05:41:23 UTC (rev 11136)
@@ -1401,7 +1401,7 @@
 {
 	int setting;
 
-	if( !PyInt_CheckExact( key ) )
+	if( !PyInt_Check( key ) )
 		return EXPP_ReturnPyObjError( PyExc_TypeError,
 				"expected an int arg" );
 

Modified: trunk/blender/source/blender/python/api2_2x/Group.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Group.c	2007-07-01 03:53:02 UTC (rev 11135)
+++ trunk/blender/source/blender/python/api2_2x/Group.c	2007-07-01 05:41:23 UTC (rev 11136)
@@ -220,7 +220,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: trunk/blender/source/blender/python/api2_2x/Ipo.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Ipo.c	2007-07-01 03:53:02 UTC (rev 11135)
+++ trunk/blender/source/blender/python/api2_2x/Ipo.c	2007-07-01 05:41:23 UTC (rev 11136)
@@ -811,7 +811,7 @@
 
 static int Ipo_setBlocktype( BPy_Ipo * self, PyObject * args )
 {
-	if( !PyInt_CheckExact( args ) )
+	if( !PyInt_Check( args ) )
 		return EXPP_ReturnIntError( PyExc_TypeError,
 				"expected int argument" );
 

Modified: trunk/blender/source/blender/python/api2_2x/Ipocurve.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Ipocurve.c	2007-07-01 03:53:02 UTC (rev 11135)
+++ trunk/blender/source/blender/python/api2_2x/Ipocurve.c	2007-07-01 05:41:23 UTC (rev 11136)
@@ -796,7 +796,7 @@
 {
 	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 " );
 	
@@ -879,7 +879,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: trunk/blender/source/blender/python/api2_2x/Lamp.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Lamp.c	2007-07-01 03:53:02 UTC (rev 11135)
+++ trunk/blender/source/blender/python/api2_2x/Lamp.c	2007-07-01 05:41:23 UTC (rev 11136)
@@ -988,7 +988,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: trunk/blender/source/blender/python/api2_2x/Material.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Material.c	2007-07-01 03:53:02 UTC (rev 11135)
+++ trunk/blender/source/blender/python/api2_2x/Material.c	2007-07-01 05:41:23 UTC (rev 11136)
@@ -1764,7 +1764,7 @@
 {
 	int param;
 
-	if( !PyInt_CheckExact ( value ) ) {
+	if( !PyInt_Check( value ) ) {
 		char errstr[128];
 		sprintf ( errstr , "expected int bitmask of 0x%08x", MA_MODE_MASK );
 		return EXPP_ReturnIntError( PyExc_TypeError, errstr );

Modified: trunk/blender/source/blender/python/api2_2x/Mesh.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Mesh.c	2007-07-01 03:53:02 UTC (rev 11135)
+++ trunk/blender/source/blender/python/api2_2x/Mesh.c	2007-07-01 05:41:23 UTC (rev 11136)
@@ -1358,15 +1358,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);
 		}
@@ -2085,7 +2085,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 );
@@ -2396,7 +2396,7 @@
 	if( !edge )
 		return -1;
 
-	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 );
@@ -3020,7 +3020,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 );
@@ -3254,7 +3254,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 );
@@ -3464,7 +3464,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 );
@@ -3476,7 +3476,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;
@@ -4114,7 +4114,7 @@
 	if( !MFace_get_pointer( self ) )
 		return -1;
 
-	if( !PyInt_CheckExact ( value ) ) {
+	if( !PyInt_Check ( value ) ) {
 		char errstr[128];
 		sprintf ( errstr , "expected int bitmask of 0x%04x", MFACE_FLAG_BITMASK );
 		return EXPP_ReturnIntError( PyExc_TypeError, errstr );
@@ -4180,7 +4180,7 @@
 	if( !MFace_get_pointer( self ) )
 		return -1;
 
-	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 );
@@ -4387,7 +4387,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" );
@@ -5370,7 +5370,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 );
@@ -5948,7 +5948,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
@@ -7030,7 +7030,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" );
 	
@@ -7758,7 +7758,7 @@
 		ME_UVEFFECT | ME_VCOLEFFECT | ME_AUTOSMOOTH | ME_SMESH |
 		ME_SUBSURF | ME_OPT_EDGES;
 
-	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 );
@@ -7816,7 +7816,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: trunk/blender/source/blender/python/api2_2x/Metaball.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Metaball.c	2007-07-01 03:53:02 UTC (rev 11135)
+++ trunk/blender/source/blender/python/api2_2x/Metaball.c	2007-07-01 05:41:23 UTC (rev 11136)
@@ -661,7 +661,7 @@
 {
 
 	int param;
-	if( !PyInt_CheckExact( value ) )
+	if( !PyInt_Check( value ) )
 		return EXPP_ReturnIntError( PyExc_TypeError,
 					"metaball.update - expected an int argument" );
 
@@ -752,7 +752,7 @@
 static int Metaelem_setType( BPy_Metaelem * self,  PyObject * value )
 {
 	int type;
-	if( !PyInt_CheckExact( value ) )
+	if( !PyInt_Check( value ) )
 		return EXPP_ReturnIntError( PyExc_TypeError,
 			"metaelem.type - expected an integer (bitmask) as argument" );
 	


@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list