mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #4769: autodoc loses the first staticmethod parameter
This commit is contained in:
2
CHANGES
2
CHANGES
@@ -16,6 +16,8 @@ Features added
|
||||
Bugs fixed
|
||||
----------
|
||||
|
||||
* #4769: autodoc loses the first staticmethod parameter
|
||||
|
||||
Testing
|
||||
--------
|
||||
|
||||
|
||||
@@ -1300,7 +1300,10 @@ class MethodDocumenter(DocstringSignatureMixin, ClassLevelDocumenter): # type:
|
||||
inspect.ismethoddescriptor(self.object):
|
||||
# can never get arguments of a C function or method
|
||||
return None
|
||||
args = Signature(self.object, bound_method=True).format_args()
|
||||
if isstaticmethod(self.object, cls=self.parent, name=self.object_name):
|
||||
args = Signature(self.object, bound_method=False).format_args()
|
||||
else:
|
||||
args = Signature(self.object, bound_method=True).format_args()
|
||||
# escape backslashes for reST
|
||||
args = args.replace('\\', '\\\\')
|
||||
return args
|
||||
|
||||
@@ -804,7 +804,7 @@ def test_generate():
|
||||
' .. py:attribute:: Class._private_inst_attr',
|
||||
' .. py:classmethod:: Class.inheritedclassmeth()',
|
||||
' .. py:method:: Class.inheritedmeth()',
|
||||
' .. py:staticmethod:: Class.inheritedstaticmeth()',
|
||||
' .. py:staticmethod:: Class.inheritedstaticmeth(cls)',
|
||||
],
|
||||
'class', 'Class', member_order='bysource', all_members=True)
|
||||
del directive.env.ref_context['py:module']
|
||||
|
||||
Reference in New Issue
Block a user