summaryrefslogtreecommitdiff
path: root/sphinx/ext/autodoc.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-07-28 18:13:57 +0200
committerGeorg Brandl <georg@python.org>2010-07-28 18:13:57 +0200
commitd6e5dfacd48c2d8bdc92a30b9bbeb3c015a03f12 (patch)
tree095f858a925a2473a71c1facda7884213f9c9233 /sphinx/ext/autodoc.py
parent4f13ff1ab7424d79dd9ed708315c6cc1d1a2c566 (diff)
downloadsphinx-git-d6e5dfacd48c2d8bdc92a30b9bbeb3c015a03f12.tar.gz
Add a constant for class types, which lacks types.ClassType in Py3k.
Diffstat (limited to 'sphinx/ext/autodoc.py')
-rw-r--r--sphinx/ext/autodoc.py13
1 files changed, 4 insertions, 9 deletions
diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py
index adf08bcde..8a827a91f 100644
--- a/sphinx/ext/autodoc.py
+++ b/sphinx/ext/autodoc.py
@@ -14,7 +14,7 @@
import re
import sys
import inspect
-from types import FunctionType, BuiltinFunctionType, MethodType, ClassType
+from types import FunctionType, BuiltinFunctionType, MethodType
from docutils import nodes
from docutils.utils import assemble_option_dict
@@ -27,15 +27,10 @@ from sphinx.application import ExtensionError
from sphinx.util.nodes import nested_parse_with_titles
from sphinx.util.compat import Directive
from sphinx.util.inspect import isdescriptor, safe_getmembers, safe_getattr
+from sphinx.util.pycompat import base_exception, class_types
from sphinx.util.docstrings import prepare_docstring
-try:
- base_exception = BaseException
-except NameError:
- base_exception = Exception
-
-
#: extended signature RE: with explicit module name separated by ::
py_ext_sig_re = re.compile(
r'''^ ([\w.]+::)? # explicit module name
@@ -866,7 +861,7 @@ class ClassDocumenter(ModuleLevelDocumenter):
@classmethod
def can_document_member(cls, member, membername, isattr, parent):
- return isinstance(member, (type, ClassType))
+ return isinstance(member, class_types)
def import_object(self):
ret = ModuleLevelDocumenter.import_object(self)
@@ -972,7 +967,7 @@ class ExceptionDocumenter(ClassDocumenter):
@classmethod
def can_document_member(cls, member, membername, isattr, parent):
- return isinstance(member, (type, ClassType)) and \
+ return isinstance(member, class_types) and \
issubclass(member, base_exception)