#14713·sphinx

Sphinx autodoc fails at formatting third-party member

Author: LecrisUTCreated Sep 30, 2026Updated Sep 30, 2026
Labelstype:bug

Describe the bug

Recently we moved an import command to global import i.e.

python
from pint import Quantity

and now sphinx fails with

WARNING: error while formatting signature for tmt.utils.templates.Quantity: 'NoneType' object has no attribute 'timedelta64' [autodoc]

Is is expected that _gather_members is navigating through all of these members as well? We could probably filter it with an __all__, but this seems like a bug on sphinx side. I tried with 8.x as well and it seems the issue is there also

How to Reproduce

In principle

python
from pint import Quantity

should show this issue

Edit: It could be something specific in pint since they do something like

python
if TYPE_CHECKING:
    import datetime

    import numpy as np

class Quantity(
    ...
):
    if TYPE_CHECKING:
        # NOTE: This list of method signatures must be kept in sync with PlainQuantity's overloads
        #   (you can find the class in pint/facets/plain/quantity.py)

        @overload
        def __new__(
            cls,
            value: datetime.timedelta | np.timedelta64,
            units: UnitLike | None = None,
        ) -> "Quantity[float]": ...

Environment Information

Platform:              linux; (Linux-6.19.12-200.fc43.x86_64-x86_64-with-glibc2.43)
Python version:        3.14.7 (main, Aug 10 2026, 00:00:00) [GCC 16.1.1 20260515 (Red Hat 16.1.1-2)])
Python implementation: CPython
Sphinx version:        9.1.1+/fa93e4e58
Docutils version:      0.22.4
Jinja2 version:        3.1.6
Pygments version:      2.21.0

Sphinx extensions

python
`shinx.ext.autodoc`

Additional context

No response