Commits

Jon Waltman committed fc3c17b

Closes #1069: Fix autodoc signature formatting of "partial" functions without kwargs (patch by Artur Gaspar).

  • Participants
  • Parent commits 5578c51

Comments (0)

Files changed (2)

 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`.

File sphinx/util/inspect.py

             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]:]