Describe the bug
I make heavy use of the type parameter syntax introduced in PEP 695 in my stub files. Combined with Sphinx AutoAPI and overloaded functions or implicitly referencing the type parameters of a class in methods, this gives up to a thousand [ref.class] diagnostics with sphinx-build -n for my 8k LoC project.
How to Reproduce
$ echo ".. py:function:: func[T](x: T, /) -> tuple[T, ...]
func[T](x: T, y: T, /) -> tuple[T, T]
.. py:class:: Spam[T]
A powerful frobnicator.
.. py:method:: eggs(arg: int) -> T
Return the result after frobnicating." > source/index.rst
$ touch source/conf.py
$ sphinx-build -n source build
Running Sphinx v9.1.0
loading translations [en]... done
making output directory... done
building [mo]: targets for 0 po files that are out of date
writing output...
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
copying assets...
copying static files...
Writing evaluated template result to /build/_static/basic.css
Writing evaluated template result to /build/_static/documentation_options.js
Writing evaluated template result to /build/_static/language_data.js
Writing evaluated template result to /build/_static/alabaster.css
copying static files: done
copying extra files...
copying extra files: done
copying assets: done
writing output... [100%] index
source/index.rst:1: WARNING: py:class reference target not found: T [ref.class]
source/ndex.rst:1: WARNING: py:class reference target not found: T [ref.class]
source/index.rst:1: WARNING: py:class reference target not found: T [ref.class]
source/index.rst:1: WARNING: py:class reference target not found: T [ref.class]
source/index.rst:1: WARNING: py:class reference target not found: T [ref.class]
source/index.rst:1: WARNING: py:class reference target not found: T [ref.class]
source/index.rst:7: WARNING: py:class reference target not found: T [ref.class]
generating indices... genindex done
writing additional pages... search done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded, 7 warnings.
The HTML pages are in build.
Environment Information
Platform: win32; (Windows-11-10.0.26200-SP0)
Python version: 3.14.5 (tags/v3.14.5:5607950, May 10 2026, 10:43:50) [MSC v.1944 64 bit (AMD64)])
Python implementation: CPython
Sphinx version: 9.1.0
Docutils version: 0.22.4
Jinja2 version: 3.1.6
Pygments version: 2.20.0
Sphinx extensions
Additional context
No response
Describe the bug
I make heavy use of the type parameter syntax introduced in PEP 695 in my stub files. Combined with Sphinx AutoAPI and overloaded functions or implicitly referencing the type parameters of a class in methods, this gives up to a thousand [ref.class] diagnostics with
sphinx-build -nfor my 8k LoC project.How to Reproduce
Environment Information
Sphinx extensions
Additional context
No response