gh-151950: Fix Sphinx reference warnings in Doc/library/importlib.rst - #157610
Merged
Merged
Conversation
…lib.rst` The Loader, InspectLoader and import_module references were written without a module from paragraphs in the importlib.machinery and importlib.util sections, where those names are not in scope; qualify them the way the rest of the file already does. Link cache_tag to the sys.implementation entry that documents it, as Doc/whatsnew/3.12.rst does. get_resource_reader has not been documented since pythongh-143513, so suppress those two references like that commit did elsewhere, and drop the reference to imp.get_tag(), removed in 3.12, from a sentence that already names its replacement. Doc/library/importlib.rst now builds clean in nit-picky mode and comes out of Doc/tools/.nitignore.
jang-hs
requested review from
AA-Turner,
FFY00,
StanFromIreland,
brettcannon,
ericsnowcurrently,
hugovk,
ncoghlan and
warsaw
as code owners
September 16, 2026 06:43
Documentation build overview
5 files changed ·
|
brettcannon
approved these changes
Sep 17, 2026
brettcannon
enabled auto-merge (squash)
September 17, 2026 18:48
|
Thanks @jang-hs for the PR, and @brettcannon for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
|
Thanks @jang-hs for the PR, and @brettcannon for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15. |
|
Thanks @jang-hs for the PR, and @brettcannon for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
|
GH-157701 is a backport of this pull request to the 3.13 branch. |
|
GH-157702 is a backport of this pull request to the 3.15 branch. |
|
GH-157703 is a backport of this pull request to the 3.14 branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Eleven "reference target not found" warnings come from
Doc/library/importlib.rst(the full list is in the issue), with four separate causes.Most of them are references written without a module --
Loader.create_module,Loader.exec_module,InspectLoader.is_packageandimport_module-- used from paragraphs that sit in theimportlib.machineryandimportlib.utilsections, whereimportlib.abcandimportlibare not the current module. The file already spells these out elsewhere, as:meth:`spec.loader.create_module <importlib.abc.Loader.create_module>``` in `module_from_spec()` and as:func:`importlib.import_module``` further down, so this uses the same qualified forms; the rendered text stays as it was.cache_tagis described inside thesys.implementationentry inDoc/library/sys.rstand has no target of its own.Doc/whatsnew/3.12.rstalready links it as ``:attr:`sys.implementation.cache_tag <sys.implementation>```, which is what the two references here now do.get_resource_readerhas not been documented since gh-143513 removed theimportlib.abc.ResourceReadersection. That commit converted the references left behind inDoc/whatsnew/3.7.rstandMisc/NEWS.dto the suppressed ``:meth:`!...``` form, but missed these two.The last one,
get_tag, isimp.get_tag(), removed in 3.12. The same sentence already points atsys.implementation.cache_tag, which replaced it, so the dead reference is dropped rather than retargeted. That is the only place where the rendered text changes.I checked with a nit-picky docs build (
make -C Doc SPHINXOPTS="--nitpicky --warning-file ..." html) against a clean build ofmain: the eleven warnings are gone, no new ones appear anywhere inDoc/, andDoc/tools/check-warnings.py --fail-if-regression --fail-if-improved --fail-if-new-news-nitexits 0.Doc/library/importlib.rsttherefore comes out ofDoc/tools/.nitignore.Found and fixed with AI assistance. I reproduced the eleven warnings against a clean build of
main, traced each one to its cause myself, and checked that the four reference forms used here are the ones already in the tree; the docs build above is my own verification.Sub-issue of #151940.
Doc/library/files #151950