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

llvm-svn: 222160
This commit is contained in:
Enrico Granata 2014-11-17 19:00:20 +00:00
parent 85a429a67a
commit 6e0566c6d9
1 changed files with 1 additions and 1 deletions

View File

@ -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)