xbmc: update patch to fix python callback error handling

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2011-06-10 21:59:59 +02:00
parent 4a5a34f705
commit f47d42e705

View File

@ -1,39 +1,34 @@
From 4bcbf6a4a0fde61c18d8de66a8d05aa441ab6fc9 Mon Sep 17 00:00:00 2001
From: Jim Carroll <thecarrolls@jiminger.com>
Date: Thu, 9 Jun 2011 14:34:24 -0400
Subject: [PATCH] Allow python error information from callbacks to make it to
the log.
---
xbmc/lib/libPython/xbmcmodule/pyutil.cpp | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/xbmc/lib/libPython/xbmcmodule/pyutil.cpp b/xbmc/lib/libPython/xbmcmodule/pyutil.cpp
index 9a98cdf..041f332 100644
--- a/xbmc/lib/libPython/xbmcmodule/pyutil.cpp
+++ b/xbmc/lib/libPython/xbmcmodule/pyutil.cpp
@@ -28,6 +28,7 @@
#include "CriticalSection.h"
#include "SingleLock.h"
#include "Application.h"
diff -Naur xbmc-10.1-Dharma/xbmc/lib/libPython/xbmcmodule/pyutil.cpp xbmc-10.1-Dharma.patch/xbmc/lib/libPython/xbmcmodule/pyutil.cpp
--- xbmc-10.1-Dharma/xbmc/lib/libPython/xbmcmodule/pyutil.cpp 2011-03-08 02:49:14.000000000 +0100
+++ xbmc-10.1-Dharma.patch/xbmc/lib/libPython/xbmcmodule/pyutil.cpp 2011-06-10 21:14:07.881047162 +0200
@@ -23,6 +23,7 @@
#include <wchar.h>
#include <vector>
#include "addons/Skin.h"
+#include "utils/log.h"
using namespace std;
@@ -203,6 +204,13 @@ void _PyXBMC_MakePendingCalls()
#include "tinyXML/tinyxml.h"
#include "utils/CharsetConverter.h"
#include "CriticalSection.h"
@@ -202,7 +203,22 @@
g_callQueue.erase(iter);
lock.Leave();
if (p.func)
+ {
p.func(p.args);
+
+ // Since the callback is likely to make it into python, and since
+ // not all of the callback functions handle errors, the error state
+ // may remain set from the previous call. As a result subsequent calls
+ // to callback functions exhibit odd behavior difficult to debug.
+ if (PyErr_Occurred())
+ {
+ CLog::Log(LOGERROR,"Exception in python callback");
+ CLog::Log(LOGERROR,"Exception in python script callback execution");
+
+ // This clears the python error state and prints it to the log
+ PyErr_Print();
+ }
+
+ }
//(*((*iter).first))((*iter).second);
lock.Enter();
iter = g_callQueue.begin();
--
1.7.5.4