Loading django/contrib/syndication/views.py +9 −9 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ from django.utils import feedgenerator, tzinfo from django.utils.encoding import force_text, iri_to_uri, smart_text from django.utils.html import escape from django.utils.http import http_date from django.utils import six from django.utils.timezone import is_naive Loading Loading @@ -69,15 +70,14 @@ class Feed(object): except AttributeError: return default if callable(attr): # Check __code__.co_argcount rather than try/excepting the # function and catching the TypeError, because something inside # the function may raise the TypeError. This technique is more # accurate. if hasattr(attr, '__code__'): argcount = attr.__code__.co_argcount else: argcount = attr.__call__.__code__.co_argcount if argcount == 2: # one argument is 'self' # Check co_argcount rather than try/excepting the function and # catching the TypeError, because something inside the function # may raise the TypeError. This technique is more accurate. try: code = six.get_function_code(attr) except AttributeError: code = six.get_function_code(attr.__call__) if code.co_argcount == 2: # one argument is 'self' return attr(obj) else: return attr() Loading django/test/_doctest.py +2 −2 Original line number Diff line number Diff line Loading @@ -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: Loading Loading @@ -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): Loading Loading
django/contrib/syndication/views.py +9 −9 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ from django.utils import feedgenerator, tzinfo from django.utils.encoding import force_text, iri_to_uri, smart_text from django.utils.html import escape from django.utils.http import http_date from django.utils import six from django.utils.timezone import is_naive Loading Loading @@ -69,15 +70,14 @@ class Feed(object): except AttributeError: return default if callable(attr): # Check __code__.co_argcount rather than try/excepting the # function and catching the TypeError, because something inside # the function may raise the TypeError. This technique is more # accurate. if hasattr(attr, '__code__'): argcount = attr.__code__.co_argcount else: argcount = attr.__call__.__code__.co_argcount if argcount == 2: # one argument is 'self' # Check co_argcount rather than try/excepting the function and # catching the TypeError, because something inside the function # may raise the TypeError. This technique is more accurate. try: code = six.get_function_code(attr) except AttributeError: code = six.get_function_code(attr.__call__) if code.co_argcount == 2: # one argument is 'self' return attr(obj) else: return attr() Loading
django/test/_doctest.py +2 −2 Original line number Diff line number Diff line Loading @@ -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: Loading Loading @@ -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): Loading