mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
* Fix exception on Python3 if nonexistent method is specified by automethod. Closes #1467
This commit is contained in:
parent
c8e2fd8683
commit
1d742bdcf5
1
CHANGES
1
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)
|
||||
====================================
|
||||
|
@ -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):
|
||||
|
@ -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'
|
||||
|
Loading…
Reference in New Issue
Block a user