doczkal / rpms / abrt

Forked from rpms/abrt 4 years ago
Clone
Blob Blame History Raw
From a9f19fb25ee6e956d29931f06a8cd919c38fba53 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 9 Jul 2014 17:55:36 +0200
Subject: [ABRT PATCH 51/66] 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 96a63ff..6cf36d0 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.8.3.1