summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES1
-rw-r--r--sphinx/ext/autodoc.py4
-rw-r--r--tests/test_autodoc.py3
3 files changed, 8 insertions, 0 deletions
diff --git a/CHANGES b/CHANGES
index 70db1ad8a..03b0ea864 100644
--- a/CHANGES
+++ b/CHANGES
@@ -13,6 +13,7 @@ Bugs fixed
* #1457: In python3 environment, make linkcheck cause "Can't convert 'bytes'
object to str implicitly" error when link target url has a hash part.
Thanks to Jorge_C.
+* #1467: Exception on Python3 if nonexistent method is specified by automethod
Release 1.2.2 (released Mar 2, 2014)
====================================
diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py
index 1b68c7b8b..34197a39f 100644
--- a/sphinx/ext/autodoc.py
+++ b/sphinx/ext/autodoc.py
@@ -1183,6 +1183,8 @@ class MethodDocumenter(DocstringSignatureMixin, ClassLevelDocumenter):
if sys.version_info >= (3, 0):
def import_object(self):
ret = ClassLevelDocumenter.import_object(self)
+ if not ret:
+ return ret
obj_from_parent = self.parent.__dict__.get(self.object_name)
if isinstance(obj_from_parent, classmethod):
self.directivetype = 'classmethod'
@@ -1196,6 +1198,8 @@ class MethodDocumenter(DocstringSignatureMixin, ClassLevelDocumenter):
else:
def import_object(self):
ret = ClassLevelDocumenter.import_object(self)
+ if not ret:
+ return ret
if isinstance(self.object, classmethod) or \
(isinstance(self.object, MethodType) and
self.object.im_self is not None):
diff --git a/tests/test_autodoc.py b/tests/test_autodoc.py
index 4c39f9578..0be694f38 100644
--- a/tests/test_autodoc.py
+++ b/tests/test_autodoc.py
@@ -542,6 +542,9 @@ def test_generate():
# attributes missing
assert_warns("failed to import function 'foobar' from module 'util'",
'function', 'util.foobar', more_content=None)
+ # method missing
+ assert_warns("failed to import method 'Class.foobar' from module 'test_autodoc';",
+ 'method', 'test_autodoc.Class.foobar', more_content=None)
# test auto and given content mixing
directive.env.temp_data['py:module'] = 'test_autodoc'