Signed-off-by: Vratislav Podzimek <vpodzime(a)redhat.com>
---
pyanaconda/exception.py | 33 ++++++++++++++++-----------------
1 file changed, 16 insertions(+), 17 deletions(-)
diff --git a/pyanaconda/exception.py b/pyanaconda/exception.py
index 5e83e2e..2da0b64 100644
--- a/pyanaconda/exception.py
+++ b/pyanaconda/exception.py
@@ -60,31 +60,30 @@ class AnacondaExceptionHandler(ExceptionHandler):
self._intf_tty_num = tty_num
self._main_thread_id = main_thread_id
- def run_handleException(self, args_tuple):
+ def run_handleException(self, dump_info):
"""
Helper method with one argument only so that it can be registered
with GLib.idle_add() to run on idle or called from a handler.
- @param args_tuple: ((ty, value, tb), obj)
+ @type dump_info: an instance of the meh.DumpInfo class
"""
- trace, obj = args_tuple
- ty, value, tb = trace
-
- super(AnacondaExceptionHandler, self).handleException((ty, value, tb),
- obj)
+ super(AnacondaExceptionHandler, self).handleException(dump_info)
return False
- def handleException(self, (ty, value, tb), obj):
+ def handleException(self, dump_info):
"""
Our own handleException method doing some additional stuff before
calling the original python-meh's one.
+ @type dump_info: an instance of the meh.DumpInfo class
@see: python-meh's ExceptionHandler.handleException
"""
+ ty = dump_info.exc_info.type
+
if issubclass(ty, blivet.errors.StorageError) and value.hardware_fault:
hw_error_msg = _("The installation was stopped due to what "
"seems to be a problem with your hardware. "
@@ -100,11 +99,10 @@ class AnacondaExceptionHandler(ExceptionHandler):
if Gtk.main_level() > 0:
# main loop is running, don't crash it by running another one
# potentially from a different thread
- GLib.idle_add(self.run_handleException,
- ((ty, value, tb), obj))
+ GLib.idle_add(self.run_handleException, dump_info)
else:
super(AnacondaExceptionHandler, self).handleException(
- (ty, value, tb), obj)
+ dump_info)
except RuntimeError:
# X not running (Gtk cannot be initialized)
@@ -113,14 +111,15 @@ class AnacondaExceptionHandler(ExceptionHandler):
if threading.current_thread().ident == self._main_thread_id:
# in the main thread, run exception handler
super(AnacondaExceptionHandler, self).handleException(
- (ty, value, tb), obj)
+ dump_info)
else:
# not in the main thread, just send message with exception
# data and let message handler run the exception handler
- hubQ.put((HUB_CODE_EXCEPTION,
- [self, ((ty, value, tb), obj)]))
+ hubQ.put((HUB_CODE_EXCEPTION, [self, dump_info]))
+
+ def postWriteHook(self, dump_info):
+ anaconda = dump_info.object
- def postWriteHook(self, (ty, value, tb), anaconda):
# See if /mnt/sysimage is present and put exception there as well
if os.access("/mnt/sysimage/root", os.X_OK):
try:
@@ -136,7 +135,7 @@ class AnacondaExceptionHandler(ExceptionHandler):
except:
pass
- def runDebug(self, (ty, value, tb)):
+ def runDebug(self, exc_info):
if self._intf_tty_num != 1:
iutil.vtActivate(1)
@@ -166,7 +165,7 @@ class AnacondaExceptionHandler(ExceptionHandler):
print("Use 'continue' command to quit the debugger and get back to
"\
"the main window")
import pdb
- pdb.post_mortem (tb)
+ pdb.post_mortem(exc_info.stack)
if self._intf_tty_num != 1:
iutil.vtActivate(self._intf_tty_num)
--
1.7.11.7