func_timer cleanup TypeError
Added code to cleanup function in func_timer.py module to tolerate TypeError on
lprint_executing call.
This should help to eliminate errors such as this:
Exception TypeError: "'NoneType' object is not callable" in <bound method
func_timer_class.__del__ of <func_timer.func_timer_class instance at
0x7f888c143560>> ignored
Change-Id: I5c13c72bdf6c344a19c12b2fd7459210c6a861e0
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/lib/func_timer.py b/lib/func_timer.py
index 5f83241..d07ba32 100644
--- a/lib/func_timer.py
+++ b/lib/func_timer.py
@@ -86,11 +86,13 @@
try:
gp.lprint_executing()
gp.lprint_var(self.__child_pid)
- except (AttributeError, KeyError):
+ except (AttributeError, KeyError, TypeError):
# NOTE: In python 3, this code fails with "KeyError:
# ('__main__',)" when calling functions like lprint_executing that
# use inspect.stack() during object destruction. No fixes found
- # so tolerating the error.
+ # so tolerating the error. In python 2.x, it may fail with
+ # TypeError. This seems to happen when cleaning up after an
+ # exception was raised.
pass
# If self.__child_pid is 0, then we are either running as the child