doczkal / rpms / abrt

Forked from rpms/abrt 4 years ago
Clone

Blame SOURCES/0274-python-provide-more-information-about-exception.patch

baab13
From e12300d1a8ec7e61db2838cb0b7c3dce193f1464 Mon Sep 17 00:00:00 2001
baab13
From: Martin Kutlak <mkutlak@redhat.com>
baab13
Date: Mon, 10 Apr 2017 13:56:17 +0200
baab13
Subject: [PATCH] python: provide more information about exception
baab13
baab13
Message was modified to provide more information about where exception happened.
baab13
baab13
$ python -c 1/0
baab13
baab13
Before:
baab13
python: detected unhandled Python exception
baab13
baab13
Now:
baab13
python: detected unhandled Python exception in 'interactive mode (python -c ...)'
baab13
baab13
Related to: #1361116
baab13
baab13
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
baab13
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
baab13
baab13
Conflicts:
baab13
	src/hooks/abrt_exception_handler3.py.in
baab13
	tests/runtests/python3-addon/runtest.sh
baab13
---
baab13
 src/hooks/abrt_exception_handler.py.in | 4 +++-
baab13
 1 file changed, 3 insertions(+), 1 deletion(-)
baab13
baab13
diff --git a/src/hooks/abrt_exception_handler.py.in b/src/hooks/abrt_exception_handler.py.in
baab13
index 7455663..dacde37 100644
baab13
--- a/src/hooks/abrt_exception_handler.py.in
baab13
+++ b/src/hooks/abrt_exception_handler.py.in
baab13
@@ -220,7 +220,9 @@ def handleMyException((etype, value, tb)):
baab13
         ## argv0 is:-c
baab13
         # Are there other cases when sys.argv[0][0] is "-"?
baab13
         if not sys.argv[0] or sys.argv[0][0] == "-":
baab13
-            syslog("detected unhandled Python exception")
baab13
+            einfo = "" if not sys.argv[0] else " (python %s ...)" % sys.argv[0]
baab13
+            syslog("detected unhandled Python exception in 'interactive mode%s'"
baab13
+                   % einfo)
baab13
             raise Exception
baab13
 
baab13
         # Ignore scripts with relative path unless "RequireAbsolutePath = no".
baab13
-- 
baab13
1.8.3.1
baab13