Merge pull request #809 from nramirezuy/get_func_args-728

get_func_args maximum recursion fix #728
This commit is contained in:
Daniel Graña 2014-07-21 13:41:03 -03:00
commit dd3b77ea2e
2 changed files with 3 additions and 0 deletions

View File

@ -193,6 +193,7 @@ class UtilsPythonTestCase(unittest.TestCase):
# TODO: how do we fix this to return the actual argument names?
self.assertEqual(get_func_args(unicode.split), [])
self.assertEqual(get_func_args(" ".join), [])
self.assertEqual(get_func_args(operator.itemgetter(2)), [])
if __name__ == "__main__":
unittest.main()

View File

@ -147,6 +147,8 @@ def get_func_args(func, stripself=False):
elif hasattr(func, '__call__'):
if inspect.isroutine(func):
return []
elif getattr(func, '__name__', None) == '__call__':
return []
else:
return get_func_args(func.__call__, True)
else: