This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch][python] Fix 2.4 build issues with exceptions


The way Python handles exceptions between 2.4 -> 3.x has changed, with
some newer methods being incompatible with older versions of Python.
This patch fixes up two instances so that it makes exception handling
compatible with all versions of Python.

OK?

Cheers,

Phil


2013-09-18  Phil Muldoon  <pmuldoon@redhat.com>

	* python/lib/gdb/command/frame_filters.py
	(InfoFrameFilter.list_frame_filters): Retrieve exception manually.
	(ShowFrameFilterPriority.invoke): Ditto.

--

diff --git a/gdb/python/lib/gdb/command/frame_filters.py b/gdb/python/lib/gdb/command/frame_filters.py
index b5d34ad..b04f477 100644
--- a/gdb/python/lib/gdb/command/frame_filters.py
+++ b/gdb/python/lib/gdb/command/frame_filters.py
@@ -16,6 +16,7 @@
 
 """GDB commands for working with frame-filters."""
 
+import sys
 import gdb
 import copy
 from gdb.FrameIterator import FrameIterator
@@ -79,7 +80,8 @@ class InfoFrameFilter(gdb.Command):
                         str(gdb.frames.get_priority(frame_filter[1])))
                     enabled = '{:<7}'.format(
                         self.enabled_string(gdb.frames.get_enabled(frame_filter[1])))
-                except Exception as e:
+                except Exception:
+                    e = sys.exc_info()[1]
                     print("  Error printing filter '"+name+"': "+str(e))
                 else:
                     print("  %s  %s  %s" % (priority, enabled, name))
@@ -448,7 +450,8 @@ class ShowFrameFilterPriority(gdb.Command):
         list_name = command_tuple[0]
         try:
             priority = self.get_filter_priority(list_name, filter_name);
-        except Exception as e:
+        except Exception:
+            e = sys.exc_info()[1]
             print("Error printing filter priority for '"+name+"':"+str(e))
         else:
             print("Priority of filter '" + filter_name + "' in list '" \


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]