Skip to content

Commit 3d88424

Browse files
committed
Fix #9844: autodoc: Failed to preserve defvalues for partial function
1 parent 538e281 commit 3d88424

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGES

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Bugs fixed
2323
decorated by functools.lru_cache
2424
* #9879: autodoc: AttributeError is raised on building document for an object
2525
having invalid __doc__ atribute
26+
* #9844: autodoc: Failed to process a function wrapped with functools.partial if
27+
:confval:`autodoc_preserve_defaults` enabled
2628
* #9872: html: Class namespace collision between autodoc signatures and
2729
docutils-0.17
2830
* #9864: mathjax: Failed to render equations via MathJax v2. The loading method

sphinx/ext/autodoc/preserve_defaults.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def update_defvalue(app: Sphinx, obj: Any, bound_method: bool) -> None:
7373
lines = inspect.getsource(obj).splitlines()
7474
if lines[0].startswith((' ', r'\t')):
7575
lines.insert(0, '') # insert a dummy line to follow what get_function_def() does.
76-
except OSError:
76+
except (OSError, TypeError):
7777
lines = []
7878

7979
try:

0 commit comments

Comments
 (0)