[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31181] trunk/blender/source/blender/ python/intern/bpy_rna.c: remove py2.x compat check for class registration.

Campbell Barton ideasman42 at gmail.com
Mon Aug 9 01:46:49 CEST 2010


Revision: 31181
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31181
Author:   campbellbarton
Date:     2010-08-09 01:46:49 +0200 (Mon, 09 Aug 2010)

Log Message:
-----------
remove py2.x compat check for class registration.

Modified Paths:
--------------
    trunk/blender/source/blender/python/intern/bpy_rna.c

Modified: trunk/blender/source/blender/python/intern/bpy_rna.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_rna.c	2010-08-08 22:49:46 UTC (rev 31180)
+++ trunk/blender/source/blender/python/intern/bpy_rna.c	2010-08-08 23:46:49 UTC (rev 31181)
@@ -4409,7 +4409,7 @@
 	const char *class_type= RNA_struct_identifier(srna);
 	PyObject *py_class= (PyObject*)py_data;
 	PyObject *base_class= RNA_struct_py_type_get(srna);
-	PyObject *item, *fitem;
+	PyObject *item;
 	PyObject *py_arg_count;
 	int i, flag, arg_count, func_arg_count;
 	const char *py_class_name = ((PyTypeObject *)py_class)->tp_name; // __name__
@@ -4446,14 +4446,9 @@
 			PyErr_Clear();
 		}
 		else {
-			Py_DECREF(item); /* no need to keep a ref, the class owns it */
+			Py_DECREF(item); /* no need to keep a ref, the class owns it (technically we should keep a ref but...) */
 
-			if (PyMethod_Check(item))
-				fitem= PyMethod_Function(item); /* py 2.x */
-			else
-				fitem= item; /* py 3.x */
-
-			if (PyFunction_Check(fitem)==0) {
+			if (PyFunction_Check(item)==0) {
 				PyErr_Format( PyExc_TypeError, "expected %.200s, %.200s class \"%.200s\" attribute to be a function", class_type, py_class_name, RNA_function_identifier(func));
 				return -1;
 			}
@@ -4461,7 +4456,7 @@
 			func_arg_count= rna_function_arg_count(func);
 
 			if (func_arg_count >= 0) { /* -1 if we dont care*/
-				py_arg_count = PyObject_GetAttrString(PyFunction_GET_CODE(fitem), "co_argcount");
+				py_arg_count = PyObject_GetAttrString(PyFunction_GET_CODE(item), "co_argcount");
 				arg_count = PyLong_AsSsize_t(py_arg_count);
 				Py_DECREF(py_arg_count);
 





More information about the Bf-blender-cvs mailing list