Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sphinx 4.3 raises an 'autodoc-before-process-signature' error with functools.partial #9844

Closed
bhrutledge opened this issue Nov 12, 2021 · 0 comments

Comments

@bhrutledge
Copy link

Describe the bug

When using autodoc_preserve_defaults and a module that defines a partial, I get the following warning from sphinx-build:

WARNING: error while formatting arguments for example_package.example_partial: Handler <function update_defvalue at 0x102f24310> for event 'autodoc-before-process-signature' threw an exception (exception: module, class, method, function, traceback, frame, or code object was expected, got partial).

I don't get this warning in Sphinx 4.2.0.

How to Reproduce

I re-used an example repo from an earlier issue: https://github.com/bhrutledge/sphinx-requests-typehints, which includes setup instructions. The rendered docs show the current behavior with Sphinx 4.2.0.

On that repo, I created a PR with Sphinx 4.3.0, where the rendered docs show the missing partial signature.

I also opened PR with Sphinx 4.3.0 but not autodoc_preserve_defaults. The rendered docs show the restored partial signature, but the default arguments are less useful.

Expected behavior

I expect Sphinx 4.3.0 to generate the same documentation as 4.2.0 without errors.

Your project

https://github.com/bhrutledge/sphinx-requests-typehints

Screenshots

No response

OS

Mac

Python version

3.9.7

Sphinx version

4.3.0

Sphinx extensions

sphinx.ext.autodoc

Extra tools

No response

Additional context

No response

@tk0miya tk0miya added this to the 4.3.1 milestone Nov 23, 2021
tk0miya added a commit to tk0miya/sphinx that referenced this issue Nov 25, 2021
tk0miya added a commit that referenced this issue Nov 27, 2021
Fix #9844: autodoc: Failed to preserve defvalues for partial function
@tk0miya tk0miya closed this as completed Nov 27, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants