WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Work around bug in Python's inspect modul

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Work around bug in Python's inspect module -- catch an IndexError exception
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sat, 17 Mar 2007 13:30:08 -0700
Delivery-date: Sat, 17 Mar 2007 13:28:58 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1174150599 0
# Node ID f40bd358129a8f83e4503bc7129c1e6598563c8c
# Parent  98eacf1b075cc8bb2ed9136a0ca381840b8d7ae2
Work around bug in Python's inspect module -- catch an IndexError exception
if the source-code lookup fails.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendLogging.py |   12 ++++++++++++
 1 files changed, 12 insertions(+)

diff -r 98eacf1b075c -r f40bd358129a tools/python/xen/xend/XendLogging.py
--- a/tools/python/xen/xend/XendLogging.py      Sat Mar 17 12:24:32 2007 +0000
+++ b/tools/python/xen/xend/XendLogging.py      Sat Mar 17 16:56:39 2007 +0000
@@ -58,6 +58,18 @@ if 'TRACE' not in logging.__dict__:
                 else:
                     return filename, frame[2]
     logging.Logger.findCaller = findCaller
+
+    # Work around a bug in Python's inspect module: findsource is supposed to
+    # raise IOError if it fails, with other functions in that module coping
+    # with that, but some people are seeing IndexError raised from there.
+    if hasattr(inspect, 'findsource'):
+        real_findsource = getattr(inspect, 'findsource')
+        def findsource(*args, **kwargs):
+            try:
+                return real_findsource(*args, **kwargs)
+            except IndexError, exn:
+                raise IOError(exn)
+        inspect.findsource = findsource
 
 
 log = logging.getLogger("xend")

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Work around bug in Python's inspect module -- catch an IndexError exception, Xen patchbot-unstable <=