diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2016-06-10 12:34:12 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-06-14 11:08:59 +0100 |
commit | c5a48931ac8db9e56f978c50861c19d0d0c808e3 (patch) | |
tree | 86b1f8d9221c0db3a97f911dd3b284a4b1550ed6 /lib/toaster/bldcontrol/management | |
parent | 3638b8e5390c36076e14c181e955505750031571 (diff) | |
download | bitbake-c5a48931ac8db9e56f978c50861c19d0d0c808e3.tar.gz |
toaster: fix wrong usage of print_exc and format_exc
First parameter of traceback.print_exc and 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.
In Python 3 comparison of integer and exception object throws exception:
TypeError: unorderable types: int() < <Exception type>()
As these APIs are usually 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: Michael Wood <michael.g.wood@intel.com>
Diffstat (limited to 'lib/toaster/bldcontrol/management')
-rw-r--r-- | lib/toaster/bldcontrol/management/commands/checksettings.py | 2 | ||||
-rw-r--r-- | lib/toaster/bldcontrol/management/commands/runbuilds.py | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/toaster/bldcontrol/management/commands/checksettings.py b/lib/toaster/bldcontrol/management/commands/checksettings.py index 2407e1bbc..8cdc81311 100644 --- a/lib/toaster/bldcontrol/management/commands/checksettings.py +++ b/lib/toaster/bldcontrol/management/commands/checksettings.py @@ -118,7 +118,7 @@ class Command(NoArgsCommand): except Exception as e: print("Failure while trying to import the toaster config file %s: %s" %\ (config_file, e)) - traceback.print_exc(e) + traceback.print_exc() return is_changed diff --git a/lib/toaster/bldcontrol/management/commands/runbuilds.py b/lib/toaster/bldcontrol/management/commands/runbuilds.py index 80782ef92..a70377012 100644 --- a/lib/toaster/bldcontrol/management/commands/runbuilds.py +++ b/lib/toaster/bldcontrol/management/commands/runbuilds.py @@ -68,7 +68,7 @@ class Command(NoArgsCommand): except Exception as e: logger.error("runbuilds: Error launching build %s" % e) - traceback.print_exc(e) + traceback.print_exc() if "[Errno 111] Connection refused" in str(e): # Connection refused, read toaster_server.out errmsg = bec.readServerLogFile() @@ -78,7 +78,7 @@ class Command(NoArgsCommand): BRError.objects.create(req = br, errtype = str(type(e)), errmsg = errmsg, - traceback = traceback.format_exc(e)) + traceback = traceback.format_exc()) br.state = BuildRequest.REQ_FAILED br.save() bec.be.lock = BuildEnvironment.LOCK_FREE |