You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cookielib documentation references Cookie module, not cookielib.Cookie class #66017
Georg, this looks as a bug in Sphinx configuration. Why module takes priority on class when the role is explicitly specified? I have counted about two hundreds of similar bugs in the documentation.
Here is a patch for 2.7 that fixes above a hundred of broken class references. But may be even more broken function references. I think it would be better to fix Sphinx rules.
This happens because the role is pretty much ignored by Sphinx for linking purposes. I remember Georg talking about the reason for this, but I forget what it was. Perhaps it would be possible to, as you suggest, have the roll affect the priority...but it may be the case that the references don't currently retain the needed information. Regardless, that would be an issue for the Sphinx tracker.
The rules are as they are mostly for backwards compatibility. But it is rarely a problem since there is only one object with a given name.
:class:`Cookie` within the docs for cookielib would not be able to link to Cookie.Cookie since it is not found in its scope. :class:`Cookie.Cookie` works, as does :class:`~Cookie.Cookie`.
When you use the "find-in-any-namespace" syntax, i.e. :class:`.Cookie` the type *will* be taken into account.
Activity
Ajtag commentedon Jun 20, 2014
all the links to Cookie class in the cookielib documentation point to Cookie module.
cookie in the documentation links to
https://docs.python.org/2/library/cookie.html#module-Cookie
cookie in the documentation should link to
https://docs.python.org/2/library/cookielib.html#cookielib.Cookie
serhiy-storchaka commentedon Mar 14, 2015
Georg, this looks as a bug in Sphinx configuration. Why module takes priority on class when the role is explicitly specified? I have counted about two hundreds of similar bugs in the documentation.
serhiy-storchaka commentedon Mar 14, 2015
Here is a patch for 2.7 that fixes above a hundred of broken class references. But may be even more broken function references. I think it would be better to fix Sphinx rules.
bitdancer commentedon Mar 14, 2015
This happens because the role is pretty much ignored by Sphinx for linking purposes. I remember Georg talking about the reason for this, but I forget what it was. Perhaps it would be possible to, as you suggest, have the roll affect the priority...but it may be the case that the references don't currently retain the needed information. Regardless, that would be an issue for the Sphinx tracker.
serhiy-storchaka commentedon Nov 9, 2015
Georg, is it possible to tune Sphinx rules?
birkenfeld commentedon Nov 9, 2015
The rules are as they are mostly for backwards compatibility. But it is rarely a problem since there is only one object with a given name.
:class:`Cookie` within the docs for cookielib would not be able to link to Cookie.Cookie since it is not found in its scope. :class:`Cookie.Cookie` works, as does :class:`~Cookie.Cookie`.
When you use the "find-in-any-namespace" syntax, i.e. :class:`.Cookie` the type *will* be taken into account.
serhiy-storchaka commentedon Nov 29, 2016
Thus the only way to fix links is to specify full names? Does docs_class_links-2.7.patch look good to you?
python-dev commentedon Dec 2, 2016
New changeset 5b40d81e8883 by Serhiy Storchaka in branch '2.7':
Issue bpo-21818: Fixed references to classes that have names matching with module
https://hg.python.org/cpython/rev/5b40d81e8883
New changeset d64e37b9204e by Serhiy Storchaka in branch '3.5':
Issue bpo-21818: Fixed references to classes that have names matching with module
https://hg.python.org/cpython/rev/d64e37b9204e
New changeset 62c9a89a2103 by Serhiy Storchaka in branch '3.6':
Issue bpo-21818: Fixed references to classes that have names matching with module
https://hg.python.org/cpython/rev/62c9a89a2103
New changeset c642c597d05c by Serhiy Storchaka in branch 'default':
Issue bpo-21818: Fixed references to classes that have names matching with module
https://hg.python.org/cpython/rev/c642c597d05c
csabella commentedon Sep 3, 2017
Can this issue be closed?