diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-03-17 10:19:30 +0100 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-03-17 16:05:55 +0100 |
| commit | 1c9bd69ff045cf304fcfe127eac53e8712d33d75 (patch) | |
| tree | 2446631fd5e91b45dcd20a8533cbd9c9a3850a7a /django/test | |
| parent | 2757d492bb6920ad1b98f19872c19ee0d8b4223d (diff) | |
[1.5.x] Stopped using non-standard __globals__ and __code__ attributes.
Some alternative implementations don't have them.
Closes #19944.
Backport of 9d4a5b00f1977d8cddf8e241fa4bb8a9e819f188 from master.
Diffstat (limited to 'django/test')
| -rw-r--r-- | django/test/_doctest.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/test/_doctest.py b/django/test/_doctest.py index 82d4a6d08e..9b8ddc9696 100644 --- a/django/test/_doctest.py +++ b/django/test/_doctest.py @@ -883,7 +883,7 @@ class DocTestFinder: if module is None: return True elif inspect.isfunction(object): - return module.__dict__ is object.__globals__ + return module.__dict__ is six.get_function_globals(object) elif inspect.isclass(object): return module.__name__ == object.__module__ elif inspect.getmodule(object) is not None: @@ -1021,7 +1021,7 @@ class DocTestFinder: # Find the line number for functions & methods. if inspect.ismethod(obj): obj = obj.__func__ - if inspect.isfunction(obj): obj = obj.__code__ + if inspect.isfunction(obj): obj = six.get_function_code(obj) if inspect.istraceback(obj): obj = obj.tb_frame if inspect.isframe(obj): obj = obj.f_code if inspect.iscode(obj): |
