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

"More than one target found" when all targets actually resolve to the same point #9577

Closed
anntzer opened this issue Aug 24, 2021 · 2 comments · Fixed by #10089
Closed

"More than one target found" when all targets actually resolve to the same point #9577

anntzer opened this issue Aug 24, 2021 · 2 comments · Fixed by #10089
Labels

Comments

@anntzer
Copy link
Contributor

anntzer commented Aug 24, 2021

Describe the bug

Sphinx emits a "More than one target found" warning when resolving :any: crossrefs even if all targets actually point to the same place, which can happen e.g. if documenting a class implemented in a private module but reexported in a public one.

How to Reproduce

In an empty directory:

mkdir pkg
echo 'from ._implementation import Foo; __all__ = ["Foo"]' >pkg/__init__.py
echo 'class Foo: """The Foo."""' >pkg/_implementation.py
sphinx-apidoc . -o doc -F -A me -V 0.0
echo $'\nThe `pkg.Foo` is also the `pkg._implementation.Foo` and also the `Foo`.' >>doc/index.rst
(cd doc; PYTHONPATH=.. make O=-Ddefault_role=any html)

emits

.../doc/index.rst:23: WARNING: more than one target found for 'any' cross-reference 'Foo': could be :py:class:`pkg.Foo` or :py:class:`pkg._implementation.Foo`

even though there's only one entry for pkg.Foo in the docs (and pkg._implementation.Foo also points there).

Expected behavior

No warning.

Your project

N/A, see script above to generate it.

Screenshots

No response

OS

linux

Python version

3.9

Sphinx version

4.1.2

Sphinx extensions

autodoc

Extra tools

No response

Additional context

No response

@ewjoachim
Copy link
Contributor

Hey @anntzer ! I've made a PR that I believe fixes your issue as well as mine (well... I think it's the same issue). Would you mind testing on branch ewjoachim:py-domain-canonical-any-10088 (gh pr checkout 10089 if you use gh) and confirm that it solves the issue for you ? if so we may close one of the tickets :)

@anntzer
Copy link
Contributor Author

anntzer commented Jan 11, 2022

Yes, this seems to work for me, thanks!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants