[Lldb-commits] [lldb] r222160 - Not all things callable have an im_self, so harden the test logic against that. getattr(, , None) is the closest to ?. we have in Python, so use that

Enrico Granata egranata at apple.com
Mon Nov 17 11:00:21 PST 2014


Author: enrico
Date: Mon Nov 17 13:00:20 2014
New Revision: 222160

URL: http://llvm.org/viewvc/llvm-project?rev=222160&view=rev
Log:
Not all things callable have an im_self, so harden the test logic against that. getattr(,,None) is the closest to ?. we have in Python, so use that

Modified:
    lldb/trunk/test/lldbtest.py

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=222160&r1=222159&r2=222160&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Mon Nov 17 13:00:20 2014
@@ -1039,7 +1039,7 @@ class Base(unittest2.TestCase):
                 print >> sbuf, "Executing tearDown hook:", getsource_if_available(hook)
             import inspect
             hook_argc = len(inspect.getargspec(hook).args)
-            if hook_argc == 0 or hook.im_self:
+            if hook_argc == 0 or getattr(hook,'im_self',None):
                 hook()
             elif hook_argc == 1:
                 hook(self)





More information about the lldb-commits mailing list