[Bf-committers] Re: [Bf-blender-cvs] CVS commit: blender/source/blender/python/api2_2x Armature.c

Yann Vernier yann at donkey.dyndns.org
Sun Dec 25 12:49:48 CET 2005


Sorry, my prior post has a reference counting bug. This one shouldn't
leak memory. I found this moments before I sent the mail, but forgot to
rerun the cvs diff. 

-- 
PGP fingerprint = 9242 DC15 2502 FEAB E15F  84C6 D538 EC09 5380 5746
-------------- next part --------------
Index: gen_utils.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/python/api2_2x/gen_utils.c,v
retrieving revision 1.40
diff -u -p -r1.40 gen_utils.c
--- gen_utils.c	10 Dec 2005 19:36:05 -0000	1.40
+++ gen_utils.c	25 Dec 2005 11:45:52 -0000
@@ -176,27 +176,29 @@ int EXPP_ReturnIntError( PyObject * type
 
 int EXPP_intError(PyObject *type, const char *format, ...)
 {
-	char *error = "";
+	PyObject *error;
 	va_list vlist;
 
 	va_start(vlist, format);
-	vsprintf(error, format, vlist);
+	error = PyString_FromFormatV(format, vlist);
 	va_end(vlist);
 
-	PyErr_SetString(type, error);
+	PyErr_SetObject(type, error);
+	Py_DECREF(error);
 	return -1;
 }
 //Like EXPP_ReturnPyObjError but takes a printf format string and multiple arguments
 PyObject *EXPP_objError(PyObject *type, const char *format, ...)
 {
-	char *error = "";
+	PyObject *error;
 	va_list vlist;
 
 	va_start(vlist, format);
-	vsprintf(error, format, vlist);
+	error = PyString_FromFormatV(format, vlist);
 	va_end(vlist);
 
-	PyErr_SetString(type, error);
+	PyErr_SetObject(type, error);
+	Py_DECREF(error);
 	return NULL;
 }
 


More information about the Bf-committers mailing list