mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Closes #1069: Fix autodoc signature formatting of "partial" functions without kwargs (patch by Artur Gaspar).
This commit is contained in:
parent
bba6104b84
commit
61e951d2ed
3
CHANGES
3
CHANGES
@ -1,6 +1,9 @@
|
||||
Release 1.2 (in development)
|
||||
============================
|
||||
|
||||
* #1069: Fixed error caused when autodoc would try to format signatures of
|
||||
"partial" functions without keyword arguments (patch by Artur Gaspar).
|
||||
|
||||
* The :confval:`latex_documents`, :confval:`texinfo_documents`, and
|
||||
:confval:`man_pages` configuration values will be set to default values based
|
||||
on the :confval:`master_doc` if not explicitly set in :file:`conf.py`.
|
||||
|
@ -27,13 +27,18 @@ if sys.version_info >= (2, 5):
|
||||
func = func.im_func
|
||||
parts = 0, ()
|
||||
if type(func) is partial:
|
||||
parts = len(func.args), func.keywords.keys()
|
||||
keywords = func.keywords
|
||||
if keywords is None:
|
||||
keywords = {}
|
||||
parts = len(func.args), keywords.keys()
|
||||
func = func.func
|
||||
if not inspect.isfunction(func):
|
||||
raise TypeError('%r is not a Python function' % func)
|
||||
args, varargs, varkw = inspect.getargs(func.func_code)
|
||||
func_defaults = func.func_defaults
|
||||
if func_defaults:
|
||||
if func_defaults is None:
|
||||
func_defaults = []
|
||||
else:
|
||||
func_defaults = list(func_defaults)
|
||||
if parts[0]:
|
||||
args = args[parts[0]:]
|
||||
|
Loading…
Reference in New Issue
Block a user