Andrei Kulakov <andrei....@gmail.com> added the comment:

Something changed between 3.8 and 3.9 so that "bare" references to methods on 
`object` no longer get linked. So for example, :meth:`__bool__` would get link 
to object.__bool__ anchor, but in 3.9+, it should be :meth:`~object.__bool__` 
for the link to be generated.

The case of __enter__ and __exit__ is that inside of contextmanager block, 
Sphinx knows that bare ref should link to contextmanager, but outside of the 
block, it does not, so no link is created.

In 3.8 docs, there are bare refs to __enter__ and __exit__ outside of relevant 
block, so they link to object.__enter__ and object.__exit__, which is of course 
wrong.

See 2nd paragraph below the block: 
https://docs.python.org/3.8/library/stdtypes.html#contextmanager.__exit__

I wasn't able to find why or how in 3.8 it was configured to auto-link bare 
refs to `object`. I looked at make.bat, conf.py and pyspecific.py

Perhaps in 3.8 the entire file was considered / configured a block for `object` 
object?

I will make a PR to fix the links.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42182>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to