All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bitbake: fix wrong usage of format_exc
@ 2016-06-10  9:49 Ed Bartosh
  2016-06-10 11:58 ` [PATCH v2] " Ed Bartosh
  0 siblings, 1 reply; 2+ messages in thread
From: Ed Bartosh @ 2016-06-10  9:49 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Ed Bartosh

From: Ed Bartosh <eduard.bartosh@intel.com>

First parameter of traceback.format_exc APIs is a 'limit' - a
number of stracktraces to print.

Passing exception object to print_exc or format_exc is incorrect,
but it works in Python 2 and causes printing only one line of traceback
as exception object is compared with the integer counter in the
traceback module code.

In Python 3 comparison of integer and exception object throws
an exception:
    TypeError: unorderable types: int() < <Exception type>()

As format_exc is used in except block of handling another
exception this can cause hard to find and debug bugs.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 lib/bb/ui/uievent.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bb/ui/uievent.py b/lib/bb/ui/uievent.py
index ca19166..9542b91 100644
--- a/lib/bb/ui/uievent.py
+++ b/lib/bb/ui/uievent.py
@@ -116,7 +116,7 @@ class BBUIEventQueue:
                 self.server.handle_request()
             except Exception as e:
                 import traceback
-                logger.error("BBUIEventQueue.startCallbackHandler: Exception while trying to handle request: %s\n%s" % (e, traceback.format_exc(e)))
+                logger.error("BBUIEventQueue.startCallbackHandler: Exception while trying to handle request: %s\n%s" % (e, traceback.format_exc()))
 
         self.server.server_close()
 
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-10 11:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-10  9:49 [PATCH] bitbake: fix wrong usage of format_exc Ed Bartosh
2016-06-10 11:58 ` [PATCH v2] " Ed Bartosh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.