Blob Blame Raw
From d402628b64b0102803481f53e9e88d63ded56c08 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 9 Jul 2014 17:55:36 +0200
Subject: [PATCH] python: support exceptions without traceback

e.g. SyntaxError (python-2.7.5-13.fc20, python-2.7.7-2.fc21)

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
 src/hooks/abrt_exception_handler.py.in | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/hooks/abrt_exception_handler.py.in b/src/hooks/abrt_exception_handler.py.in
index cb32e14..fa4f34f 100644
--- a/src/hooks/abrt_exception_handler.py.in
+++ b/src/hooks/abrt_exception_handler.py.in
@@ -55,12 +55,14 @@ def write_dump(tb_text, tb):
         executable = sys.argv[0]
 
     dso_list = None
-    try:
-        import rpm
-        dso_list = get_dso_list(tb)
-    except ImportError as imperr:
-        syslog("RPM module not available, cannot query RPM db for package "\
-               "names")
+    # Trace back is None in case of SyntaxError exception.
+    if tb:
+        try:
+            import rpm
+            dso_list = get_dso_list(tb)
+        except ImportError as imperr:
+            syslog("RPM module not available, cannot query RPM db for package "\
+                   "names")
 
     # Open ABRT daemon's socket and write data to it
     try:
-- 
1.9.3