summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorEd Bartosh <eduard.bartosh@intel.com>2016-06-10 14:58:17 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-06-16 11:51:26 +0100
commit772e9b4eabf054cadb8ad2dc6b223aa6c30c7f46 (patch)
tree9e2c544940f461e35cc642584388fb35c7a04d1c /bitbake
parent39ed5441c58daedddca8dfaee1d310f5c62337e6 (diff)
downloadpoky-772e9b4eabf054cadb8ad2dc6b223aa6c30c7f46.tar.gz
bitbake: bitbake: fix wrong usage of format_exc
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. (Bitbake rev: a9509949d7e2adba6e3cd89f97daa19a955855b5) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/cooker.py2
-rw-r--r--bitbake/lib/bb/ui/uievent.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 907565401d..60ee5d7c4a 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -330,7 +330,7 @@ class BBCooker:
330 f.write("%s\n" % json.dumps({"class":event.__module__ + "." + event.__class__.__name__, "vars":json.dumps(pickle.dumps(event)) })) 330 f.write("%s\n" % json.dumps({"class":event.__module__ + "." + event.__class__.__name__, "vars":json.dumps(pickle.dumps(event)) }))
331 except Exception as e: 331 except Exception as e:
332 import traceback 332 import traceback
333 print(e, traceback.format_exc(e)) 333 print(e, traceback.format_exc())
334 334
335 335
336 def send(self, event): 336 def send(self, event):
diff --git a/bitbake/lib/bb/ui/uievent.py b/bitbake/lib/bb/ui/uievent.py
index ca1916664d..9542b911ca 100644
--- a/bitbake/lib/bb/ui/uievent.py
+++ b/bitbake/lib/bb/ui/uievent.py
@@ -116,7 +116,7 @@ class BBUIEventQueue:
116 self.server.handle_request() 116 self.server.handle_request()
117 except Exception as e: 117 except Exception as e:
118 import traceback 118 import traceback
119 logger.error("BBUIEventQueue.startCallbackHandler: Exception while trying to handle request: %s\n%s" % (e, traceback.format_exc(e))) 119 logger.error("BBUIEventQueue.startCallbackHandler: Exception while trying to handle request: %s\n%s" % (e, traceback.format_exc()))
120 120
121 self.server.server_close() 121 self.server.server_close()
122 122