diff options
| author | Georg Brandl <georg@python.org> | 2014-03-01 08:07:31 +0100 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2014-03-01 08:07:31 +0100 |
| commit | 3f67ded92dde41315d421e660786be2f3d7c64cf (patch) | |
| tree | 1490218b0c26b665f7a058d4b7c1dc21a61b7336 /sphinx/util | |
| parent | 532e6db1f0d4f8ae9cc8a8d54cfa70ef3e98682a (diff) | |
| parent | 90a3b700dde603f76edd156d9226b12bd113cd1b (diff) | |
| download | sphinx-3f67ded92dde41315d421e660786be2f3d7c64cf.tar.gz | |
merge with stable
Diffstat (limited to 'sphinx/util')
| -rw-r--r-- | sphinx/util/inspect.py | 6 | ||||
| -rw-r--r-- | sphinx/util/pycompat.py | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py index d835bc41..3b51e28b 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): @@ -146,6 +146,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 4c9ef18d..47ff6311 100644 --- a/sphinx/util/pycompat.py +++ b/sphinx/util/pycompat.py @@ -48,6 +48,7 @@ if sys.version_info >= (3, 0): 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 @@ -71,6 +72,7 @@ else: sys_encoding = locale.getpreferredencoding() # use Python 3 name from itertools import izip_longest as zip_longest + import __builtin__ as builtins def execfile_(filepath, _globals): |
