[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11713] trunk/blender/source/blender/ python/api2_2x: aparently mingw was still having problems, fixed this properly by using PyType_Ready, this needed some changes to the PyType to work.

Campbell Barton cbarton at metavr.com
Sun Aug 19 21:06:42 CEST 2007


Revision: 11713
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11713
Author:   campbellbarton
Date:     2007-08-19 21:06:42 +0200 (Sun, 19 Aug 2007)

Log Message:
-----------
aparently mingw was still having problems, fixed this properly by using PyType_Ready, this needed some changes to the PyType to work.

Modified Paths:
--------------
    trunk/blender/source/blender/python/api2_2x/Types.c
    trunk/blender/source/blender/python/api2_2x/rgbTuple.c

Modified: trunk/blender/source/blender/python/api2_2x/Types.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Types.c	2007-08-19 18:58:49 UTC (rev 11712)
+++ trunk/blender/source/blender/python/api2_2x/Types.c	2007-08-19 19:06:42 UTC (rev 11713)
@@ -128,7 +128,7 @@
 	euler_Type.ob_type = &PyType_Type;
 	matrix_Type.ob_type = &PyType_Type;
 	quaternion_Type.ob_type = &PyType_Type;
-	rgbTuple_Type.ob_type = &PyType_Type;
+	PyType_Ready( &rgbTuple_Type );
 	vector_Type.ob_type = &PyType_Type;
 	property_Type.ob_type = &PyType_Type;
 	point_Type.ob_type = &PyType_Type;

Modified: trunk/blender/source/blender/python/api2_2x/rgbTuple.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/rgbTuple.c	2007-08-19 18:58:49 UTC (rev 11712)
+++ trunk/blender/source/blender/python/api2_2x/rgbTuple.c	2007-08-19 19:06:42 UTC (rev 11713)
@@ -86,10 +86,10 @@
 	PyObject_HEAD_INIT( NULL ) 
 	0,	/* ob_size */
 	"rgbTuple",		/* tp_name */
-	0,			/* tp_basicsize */
+	sizeof( BPy_rgbTuple ),			/* tp_basicsize */
 	0,			/* tp_itemsize */
 	/* methods */
-	( destructor )PyObject_Del,		/* tp_dealloc */
+	0,			/* tp_dealloc */
 	0,			/* tp_print */
 	( getattrfunc ) rgbTuple_getAttr,	/* tp_getattr */
 	( setattrfunc ) rgbTuple_setAttr,	/* tp_setattr */
@@ -99,11 +99,31 @@
 	&rgbTupleAsSequence,	/* tp_as_sequence */
 	&rgbTupleAsMapping,	/* tp_as_mapping */
 	0,			/* tp_as_hash */
-	0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, Py_TPFLAGS_DEFAULT,
 	0,			/* tp_doc */
 	0, 0, 0, 0, 0, 0,
 	0,			/* tp_methods */
 	0,			/* tp_members */
+	0,     /* struct PyGetSetDef *tp_getset; */
+	0,                       /* struct _typeobject *tp_base; */
+	0,                       /* PyObject *tp_dict; */
+	0,                       /* descrgetfunc tp_descr_get; */
+	0,                       /* descrsetfunc tp_descr_set; */
+	0,                          /* long tp_dictoffset; */
+	0,                       /* initproc tp_init; */
+	0,                       /* allocfunc tp_alloc; */
+	0,                       /* newfunc tp_new; */
+	/*  Low-level free-memory routine */
+	0,                       /* freefunc tp_free;  */
+	/* For PyObject_IS_GC */
+	0,                       /* inquiry tp_is_gc;  */
+	0,                       /* PyObject *tp_bases; */
+	/* method resolution order */
+	0,                       /* PyObject *tp_mro;  */
+	0,                       /* PyObject *tp_cache; */
+	0,                       /* PyObject *tp_subclasses; */
+	0,                       /* PyObject *tp_weaklist; */
+	0
 };
 
 /*****************************************************************************/
@@ -111,14 +131,8 @@
 /*****************************************************************************/
 PyObject *rgbTuple_New( float *rgb[3] )
 {
-	BPy_rgbTuple *rgbTuple;
+	BPy_rgbTuple *rgbTuple = PyObject_NEW( BPy_rgbTuple, &rgbTuple_Type );
 
-	rgbTuple_Type.ob_type = &PyType_Type;
-	rgbTuple_Type.tp_dealloc = (destructor)&PyObject_Del;
-	rgbTuple =
-		( BPy_rgbTuple * ) PyObject_NEW( BPy_rgbTuple,
-						 &rgbTuple_Type );
-
 	if( rgbTuple == NULL )
 		return EXPP_ReturnPyObjError( PyExc_MemoryError,
 					      "couldn't create rgbTuple object" );





More information about the Bf-blender-cvs mailing list