[asterisk-commits] russell: branch russell/bindings r102967 - /team/russell/bindings/cdr/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Feb 7 23:47:41 CST 2008


Author: russell
Date: Thu Feb  7 23:47:38 2008
New Revision: 102967

URL: http://svn.digium.com/view/asterisk?view=rev&rev=102967
Log:
print python traceback if we fail to load a configured module

Modified:
    team/russell/bindings/cdr/cdr_python.c

Modified: team/russell/bindings/cdr/cdr_python.c
URL: http://svn.digium.com/view/asterisk/team/russell/bindings/cdr/cdr_python.c?view=diff&rev=102967&r1=102966&r2=102967
==============================================================================
--- team/russell/bindings/cdr/cdr_python.c (original)
+++ team/russell/bindings/cdr/cdr_python.c Thu Feb  7 23:47:38 2008
@@ -74,7 +74,7 @@
 static void post_python_cdr(struct py_cdr_mod *py_cdr_mod, struct ast_cdr *cdr)
 {
 	PyThreadState *my_thread_state;
-	PyObject *fn_obj = NULL, *func_obj = NULL, *mod_obj = NULL,
+	PyObject *func_obj = NULL, *mod_obj = NULL, *fn_obj = NULL,
 		*cdr_obj = NULL, *args_obj = NULL, *res_obj = NULL;
 	swig_type_info *ast_cdr_type_info = NULL;
 
@@ -90,10 +90,10 @@
 	}
 
 	mod_obj = PyImport_Import(fn_obj);
-	Py_DECREF(fn_obj);
-	fn_obj = NULL;
 	if (!mod_obj) {
 		ast_log(LOG_ERROR, "Failed to open python module (%s)\n", py_cdr_mod->name);
+		if (PyErr_Occurred())
+			PyErr_Print();
 		goto cleanup;
 	}
 
@@ -139,6 +139,7 @@
 	Py_XDECREF(cdr_obj);
 	Py_XDECREF(func_obj);
 	Py_XDECREF(mod_obj);
+	Py_XDECREF(fn_obj);
 	PyThreadState_Swap(NULL);
 	PyThreadState_Clear(my_thread_state);
 	PyThreadState_Delete(my_thread_state);




More information about the asterisk-commits mailing list