@@ -861,7 +861,7 @@ def _from_module(self, module, object):
861861 if module is None :
862862 return True
863863 elif inspect .isfunction (object ):
864- return module .__dict__ is object .func_globals
864+ return module .__dict__ is object .__globals__
865865 elif inspect .isclass (object ):
866866 return module .__name__ == object .__module__
867867 elif inspect .getmodule (object ) is not None :
@@ -926,7 +926,7 @@ def _find(self, tests, obj, name, module, source_lines, globs, seen):
926926 if isinstance (val , staticmethod ):
927927 val = getattr (obj , valname )
928928 if isinstance (val , classmethod ):
929- val = getattr (obj , valname ).im_func
929+ val = getattr (obj , valname ).__func__
930930
931931 # Recurse to methods, properties, and nested classes.
932932 if ((inspect .isfunction (val ) or inspect .isclass (val ) or
@@ -998,8 +998,8 @@ def _find_lineno(self, obj, source_lines):
998998 break
999999
10001000 # Find the line number for functions & methods.
1001- if inspect .ismethod (obj ): obj = obj .im_func
1002- if inspect .isfunction (obj ): obj = obj .func_code
1001+ if inspect .ismethod (obj ): obj = obj .__func__
1002+ if inspect .isfunction (obj ): obj = obj .__code__
10031003 if inspect .istraceback (obj ): obj = obj .tb_frame
10041004 if inspect .isframe (obj ): obj = obj .f_code
10051005 if inspect .iscode (obj ):
0 commit comments