mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
[py3] Switched to Python 3-compatible introspection.
This commit is contained in:
@@ -861,7 +861,7 @@ class DocTestFinder:
|
||||
if module is None:
|
||||
return True
|
||||
elif inspect.isfunction(object):
|
||||
return module.__dict__ is object.func_globals
|
||||
return module.__dict__ is object.__globals__
|
||||
elif inspect.isclass(object):
|
||||
return module.__name__ == object.__module__
|
||||
elif inspect.getmodule(object) is not None:
|
||||
@@ -926,7 +926,7 @@ class DocTestFinder:
|
||||
if isinstance(val, staticmethod):
|
||||
val = getattr(obj, valname)
|
||||
if isinstance(val, classmethod):
|
||||
val = getattr(obj, valname).im_func
|
||||
val = getattr(obj, valname).__func__
|
||||
|
||||
# Recurse to methods, properties, and nested classes.
|
||||
if ((inspect.isfunction(val) or inspect.isclass(val) or
|
||||
@@ -998,8 +998,8 @@ class DocTestFinder:
|
||||
break
|
||||
|
||||
# Find the line number for functions & methods.
|
||||
if inspect.ismethod(obj): obj = obj.im_func
|
||||
if inspect.isfunction(obj): obj = obj.func_code
|
||||
if inspect.ismethod(obj): obj = obj.__func__
|
||||
if inspect.isfunction(obj): obj = obj.__code__
|
||||
if inspect.istraceback(obj): obj = obj.tb_frame
|
||||
if inspect.isframe(obj): obj = obj.f_code
|
||||
if inspect.iscode(obj):
|
||||
|
||||
Reference in New Issue
Block a user