Skip to content

Sphinx 7.1 raises an 'autodoc-before-process-signature' error with functools.partial on Python 3.8 #11767

@woodruffw

Description

@woodruffw

Describe the bug

I'm filing this as a potential regression for #9844.

The proximate cause appears to be the same: when using autodoc_preserve_defaults and a module containing a partial, sphinx-build produces:

WARNING: error while formatting arguments for twine.package.Hexdigest.__new__: Handler <function update_defvalue at 0x7f1e066c7b80> for event 'autodoc-before-process-signature' threw an exception (exception: )
WARNING: error while formatting arguments for twine.utils.get_cacert: Handler <function update_defvalue at 0x7f1e066c7b80> for event 'autodoc-before-process-signature' threw an exception (exception: )
WARNING: error while formatting arguments for twine.utils.get_clientcert: Handler <function update_defvalue at 0x7f1e066c7b80> for event 'autodoc-before-process-signature' threw an exception (exception: )

I only get this warning on Python 3.8 with Sphinx 7.1.0 and later. Later versions of Python (at least 3.11 and newer) appear to work without problems, as do versions of Sphinx before 7.1.0.

As such, I strongly suspect that this is a regression in 7.1.0 and newer.

How to Reproduce

I'm working on a reproducer now, and will embed it here when finished. In the mean time, you can see this error on this twine PR: pypa/twine#1029

And in the CI logs here: https://github.com/pypa/twine/actions/runs/6974523934/job/18980341503?pr=1029

Environment Information

Platform:              darwin; (macOS-14.1.1-arm64-arm-64bit)
Python version:        3.8.18 (default, Oct  3 2023, 18:33:37) 
[Clang 15.0.0 (clang-1500.0.40.1)])
Python implementation: CPython
Sphinx version:        7.1.0
Docutils version:      0.20.1
Jinja2 version:        3.1.2
Pygments version:      2.17.2

I've also confirmed that the error is present on 7.1.1 and 7.1.2.

Sphinx extensions

I expect Sphinx 7.2.3 and later to generate the same documentation as 7.2.2 and earlier without errors.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions