diff options
author | Georg Brandl <georg@python.org> | 2014-03-01 08:08:16 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-03-01 08:08:16 +0100 |
commit | 4ea37b595fb92c6e1f7f9f952ac2c59100a9b648 (patch) | |
tree | b827ca74310a9455c51b2355e079f787c090dc20 | |
parent | 529519275eda2912fdd4a300769f56af4ddf1d85 (diff) | |
parent | f3dba82564ed76fc8016051a949859aa26d3cc2e (diff) | |
download | sphinx-git-4ea37b595fb92c6e1f7f9f952ac2c59100a9b648.tar.gz |
merge
-rw-r--r-- | sphinx/util/inspect.py | 6 | ||||
-rw-r--r-- | sphinx/util/pycompat.py | 5 |
2 files changed, 8 insertions, 3 deletions
diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py index 61061a9af..863e731ff 100644 --- a/sphinx/util/inspect.py +++ b/sphinx/util/inspect.py @@ -16,7 +16,7 @@ import sys inspect = __import__('inspect') from sphinx.util import force_decode -from sphinx.util.pycompat import bytes +from sphinx.util.pycompat import bytes, builtins if sys.version_info >= (3, 0): @@ -151,6 +151,6 @@ def is_builtin_class_method(obj, attr_name): classes = [c for c in inspect.getmro(obj) if attr_name in c.__dict__] cls = classes[0] if classes else object - if not hasattr(__builtins__, cls.__name__): + if not hasattr(builtins, safe_getattr(cls, '__name__', '')): return False - return getattr(__builtins__, cls.__name__) is cls + return getattr(builtins, safe_getattr(cls, '__name__', '')) is cls diff --git a/sphinx/util/pycompat.py b/sphinx/util/pycompat.py index 1e5ea3145..5f6e59eeb 100644 --- a/sphinx/util/pycompat.py +++ b/sphinx/util/pycompat.py @@ -48,6 +48,8 @@ if sys.version_info >= (3, 0): # try to match ParseError details with SyntaxError details raise SyntaxError(err.msg, (filepath, lineno, offset, err.value)) return unicode(tree) + from itertools import zip_longest # Python 3 name + import builtins else: # Python 2 @@ -69,6 +71,9 @@ else: # error handler import locale sys_encoding = locale.getpreferredencoding() + # use Python 3 name + from itertools import izip_longest as zip_longest + import __builtin__ as builtins def execfile_(filepath, _globals): |