[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24532] trunk/blender/source/blender/ python/intern/bpy_rna.c: generating docs can make the rna api generate wrnings (which is fine)

Campbell Barton ideasman42 at gmail.com
Thu Nov 12 16:46:45 CET 2009


Revision: 24532
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24532
Author:   campbellbarton
Date:     2009-11-12 16:46:45 +0100 (Thu, 12 Nov 2009)

Log Message:
-----------
generating docs can make the rna api generate wrnings (which is fine)
but was giving python decoding errors and didnt even show the warning.

for now just print to the console fixes this

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	2009-11-12 15:45:08 UTC (rev 24531)
+++ trunk/blender/source/blender/python/intern/bpy_rna.c	2009-11-12 15:46:45 UTC (rev 24532)
@@ -419,11 +419,20 @@
 				ret = PyUnicode_FromString( item->identifier );
 			}
 			else {
+    			char *ptr_name= RNA_struct_name_get_alloc(ptr, NULL, FALSE);
+			
 				/* prefer not fail silently incase of api errors, maybe disable it later */
-				char error_str[128];
-				sprintf(error_str, "RNA Warning: Current value \"%d\" matches no enum", val);
+				printf("RNA Warning: Current value \"%d\" matches no enum in '%s', '%s', '%s'\n", val, RNA_struct_identifier(ptr->type), ptr_name, RNA_property_identifier(prop));
+
+#if 0           // gives python decoding errors while generating docs :(
+				char error_str[256];
+				snprintf(error_str, sizeof(error_str), "RNA Warning: Current value \"%d\" matches no enum in '%s', '%s', '%s'", val, RNA_struct_identifier(ptr->type), ptr_name, RNA_property_identifier(prop));
 				PyErr_Warn(PyExc_RuntimeWarning, error_str);
+#endif
 
+	            if(ptr_name) 
+		            MEM_freeN(ptr_name);
+
 				ret = PyUnicode_FromString( "" );
 			}
 





More information about the Bf-blender-cvs mailing list