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.1.2 breaks base class detection #9504

Closed
adamjstewart opened this issue Jul 26, 2021 · 1 comment
Closed

Sphinx 4.1.2 breaks base class detection #9504

adamjstewart opened this issue Jul 26, 2021 · 1 comment

Comments

@adamjstewart
Copy link
Contributor

Describe the bug

We noticed a regression in Sphinx 4.1.2 in our CI. In Spack, we have a single base class, PackageBase, that is subclassed in several places, including BundlePackage.

In Sphinx 4.1.1, the base class of BundlePackage was correctly detected as spack.package.PackageBase. In Sphinx 4.1.2, the base class is now detected as spack.package.None. This may have something to do with our use of six.with_metaclass since all other base classes are correctly determined.

How to Reproduce

$ git clone https://github.com/spack/spack
$ cd spack/lib/spack/docs
$ pip install -r requirements.txt
$ make
...
Warning, treated as error:
/home/runner/work/spack/spack/lib/spack/spack/package.py:docstring of spack.package.BundlePackage:1:py:obj reference target not found: spack.package.None

Expected behavior

I would expect the base class to be resolved correctly just like in Sphinx 4.1.1.

Your project

https://github.com/spack/spack

Screenshots

No response

OS

Ubuntu 20.04

Python version

3.8.11

Sphinx version

4.1.2

Sphinx extensions

sphinx.ext.autodoc

Extra tools

graphviz

Additional context

For now, we're pinning Sphinx to 4.1.1 or older, see spack/spack#25097

@scheibelp

@tk0miya tk0miya added this to the 4.1.3 milestone Jul 27, 2021
tk0miya added a commit to tk0miya/sphinx that referenced this issue Jul 30, 2021
…ent class

Autodoc generates incorrect references to the parent class the target
class inherites the class having `_name` attribute.  It conciders the
parent is a kind of SpecialForm'ed class by mistake.  This uses
`isinstance(X, SpecialForm)` to check that.

Note: SpecialForm became a class since Python 3.7.
@tk0miya
Copy link
Member

tk0miya commented Jul 30, 2021

Thank you for reporting. This must be a regression of 4.1.2. I'll fix this soon (see #9515).

Note: I confirmed the error with this Dockefile:

FROM python:3.8-slim

RUN apt update; apt install -y build-essential curl git unzip vim
RUN git clone https://github.com/spack/spack
WORKDIR /spack/lib/spack/docs
RUN pip3 install -r requirements.txt
RUN apt install -y graphviz
RUN pip3 install -U Sphinx
RUN make

tk0miya added a commit that referenced this issue Aug 1, 2021
Fix #9504: autodoc: generate incorrect reference to the parent class
@tk0miya tk0miya closed this as completed Aug 1, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 1, 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