Add a inspect sanity check and note about bound methods

Change-Id: I4be714283b2ca3dfc3ba9dec0c9a3969fa5a458a
This commit is contained in:
Joshua Harlow
2013-10-05 17:39:07 +00:00
parent 86d6bfe11f
commit 6ccac5f334

View File

@@ -68,7 +68,13 @@ def get_callable_name(function):
def is_bound_method(method):
return getattr(method, 'im_self', None) is not None
"""Returns if the method given is a bound to a object or not."""
if not inspect.ismethod(method):
return False
# NOTE(harlowja): instance to which this method is bound, or None
if getattr(method, 'im_self', None) is not None:
return True
return False
def _get_arg_spec(function):