]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bitbake: fix wrong usage of format_exc
authorEd Bartosh <eduard.bartosh@intel.com>
Fri, 10 Jun 2016 11:58:17 +0000 (14:58 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 16 Jun 2016 10:51:07 +0000 (11:51 +0100)
First parameter of traceback.format_exc is a 'limit' - a number
of stracktraces to format.

Passing exception object to format_exc is incorrect, but it works in
Python 2 as this code from traceback module works:
    while tb is not None and (limit is None or n < limit):
Comparing integer counter n with the exception object in Python 2
always results in True. However, in Python 3 it throws 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>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/bb/cooker.py
lib/bb/ui/uievent.py

index 907565401d0700e7842a182caacd3b0d0e937443..60ee5d7c4a2dc24f0b31bf044e52d4b4f07ae3a1 100644 (file)
@@ -330,7 +330,7 @@ class BBCooker:
                                 f.write("%s\n" % json.dumps({"class":event.__module__ + "." + event.__class__.__name__, "vars":json.dumps(pickle.dumps(event)) }))
                             except Exception as e:
                                 import traceback
-                                print(e, traceback.format_exc(e))
+                                print(e, traceback.format_exc())
 
 
                     def send(self, event):
index ca1916664df3053552cc057d5a7feaf6fe3ec137..9542b911ca0984ccdb6aac550e6ef610b538cf75 100644 (file)
@@ -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()