Skip to content

Fix autodoc of partials wrapping imported functions - #14701

Open
HanpuLi wants to merge 2 commits into
sphinx-doc:masterfrom
HanpuLi:fix/8550-external-partial-autodoc
Open

HanpuLi wants to merge 2 commits into
sphinx-doc:masterfrom
HanpuLi:fix/8550-external-partial-autodoc

Conversation

@HanpuLi

@HanpuLi HanpuLi commented Sep 19, 2026 •

Copy link
Copy Markdown

Fixes #8550.

A partial assigned in a module is a local member even when the function it wraps comes from another module. Autodoc currently unwraps the partial before its module check, so these local partials are mistaken for imported members and omitted unless :imported-members: is enabled.

Record assignment names in ModuleAnalyzer and use that source information to distinguish a locally assigned partial from a genuinely imported partial. This keeps the existing imported-member filtering while allowing the local partial to be documented. The check is applied to both the current autodoc implementation and the retained legacy class-based implementation.

Tests cover a local partial wrapping a function imported from another module, alongside the existing imported-partial case. A text-build regression also runs with autodoc_use_legacy_class_based = True; reverting only the legacy check_module() change makes that regression fail.

Verification:

  • pytest -q tests/test_ext_autodoc/test_ext_autodoc.py (84 passed, 1 skipped)
  • focused current/legacy/imported-partial regressions (3 passed)
  • pytest -q tests/test_pycode (82 passed)
  • Ruff check and format check on changed Python files
  • git diff --check

CI note: the remaining Docutils HEAD and LaTeX failures are baseline failures on the exact base commit b04a210. Comparing the failed-test-name sets between the base CI run and this PR found no PR-only failures.

@HanpuLi
HanpuLi force-pushed the fix/8550-external-partial-autodoc branch from 4625538 to ebcb366 Compare September 20, 2026 16:50

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Partial functions are not documented when the original function comes from a different module

1 participant