Skip to content

Sphinx 4.0 finds more than one target for cross-reference #9205

@felixhuettner

Description

@felixhuettner

Hello everyone,

Describe the bug
After upgrading to 4.0.0 we have discovered that existing code is raising a warning with more than one target found for cross-reference. In 3.5.4 we did not see this warning

To Reproduce
I have set up a minimal reproduction repository here: https://github.com/felixhuettner/sphinx-duplicate-import-repoduction

Steps to reproduce the behavior:

$ git clone https://github.com/felixhuettner/sphinx-duplicate-import-repoduction
$ cd sphinx-duplicate-import-repoduction
$ pip install -e .
$ pip install sphinx
$ cd docs
$ sphinx-build -W . _build

Output of the sphinx-build command:

❯ sphinx-build -W . _build
Running Sphinx v4.0.0+/acf66bc4d
making output directory... done
[autosummary] generating autosummary for: index.rst
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 1 source files that are out of date
updating environment: [new config] 1 added, 0 changed, 0 removed
reading sources... [100%] index
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index

Warning, treated as error:
..../sphinxtest/test/file2.py:docstring of test.file2.SomeClass.somemethod::more than one target found for cross-reference 'TestError': test.TestError, test.file1.TestError

Expected behavior
no warning appears

Your project
https://github.com/felixhuettner/sphinx-duplicate-import-repoduction

Environment info

  • OS: Linux
  • Python version: 3.9.4
  • Sphinx version: 4.0.0
  • Sphinx extensions: sphinx.ext.autosummary

Additional context
I have bisected the issue to be introduced by acf66bc

Thanks verry much

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions