Skip to content

Commit

Permalink
update CHANGES
Browse files Browse the repository at this point in the history
  • Loading branch information
picnixz committed Aug 3, 2023
1 parent 835254a commit 36d6593
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions CHANGES
Expand Up @@ -9,6 +9,12 @@ Dependencies
Incompatible changes
--------------------

* #11459: ``sphinx.ext.autodoc.preserve_defaults.get_function_def`` is
renamed ``sphinx.ext.autodoc.preserve_defaults.get_arguments`` and its
signature is updated accordingly. It now extracts the ``ast.arguments`` from
a function or a lambda function object.
Patch by Bénédikt Tran.

Deprecated
----------

Expand Down Expand Up @@ -36,12 +42,18 @@ Features added
Patch by Rouslan Korneychuk.
* 10938: doctest: Add :confval:`doctest_show_successes` option.
Patch by Trey Hunner.
* #11459: ``sphinx.ext.autodoc.preserve_defaults``: Add support for
``async def`` functions and lambda functions.
Patch by Bénédikt Tran.

Bugs fixed
----------

* #11077: graphviz: Fix relative links from within the graph.
Patch by Ralf Grubenmann.
* #11459: ``sphinx.ext.autodoc.preserve_defaults``: fix lambda functions
used inside ``@property`` should be ignored in a multi-line context.
Patch by Bénédikt Tran.
* #11529: Line Block in LaTeX builder outputs spurious empty token.
Patch by Adrian Vollmer.

Expand Down
4 changes: 2 additions & 2 deletions sphinx/ext/autodoc/preserve_defaults.py
Expand Up @@ -46,7 +46,7 @@ def get_arguments(obj: Any) -> ast.arguments | None:
# subject is placed inside class or block. To read its docstring,
# this adds if-block before the declaration.
module = ast.parse('if True:\n' + source)
subject = module.body[0].body[0]
subject = module.body[0].body[0] # type: ignore[attr-defined]
else:
module = ast.parse(source)
subject = module.body[0]
Expand All @@ -67,7 +67,7 @@ def get_arguments(obj: Any) -> ast.arguments | None:
# propagated).
raise

def _get_arguments(x: ast.AST) -> ast.arguments | None:
def _get_arguments(x: Any) -> ast.arguments | None:
if isinstance(x, (ast.AsyncFunctionDef, ast.FunctionDef, ast.Lambda)):
return x.args
if isinstance(x, (ast.Assign, ast.AnnAssign)):
Expand Down

0 comments on commit 36d6593

Please sign in to comment.