In development of 3.0, Sphinx starts to obey to the rule of
"Identifier Normalization" of docutils. This extends it to allow
dots(".") and underscores("_") for node identifier.
It allows Sphinx to generate node identifier from source string as
possible as it is (bacause dots and underscores are usually used in
many programming langauges).
This change will keep not to break hyperlinks as possible.
In Python 3, the default encoding of source files is utf-8. The encoding
cookie is now unnecessary and redundant so remove it. For more details,
see the docs:
https://docs.python.org/3/howto/unicode.html#the-string-type
> The default encoding for Python source code is UTF-8, so you can
> simply include a Unicode character in a string literal ...
Includes a fix for the flake8 header checks to stop expecting an
encoding cookie.
Parameter and variable types in the Python domain have the
counter-intuitive behavior of matching instance methods (or likely any
other objects) rather than classes, e.g.:
```python
class Foo(object):
def list(self):
"""List some things."""
def bar(x):
"""
:param x: x
:type x: list
"""
```
`bar()` will link to `Foo.list()` rather than the standard library
`list` type.
Moved #3465 here, to address this in `stable` instead.
This fixes a problem with the Python domain object nesting. Because only one
object name was stored in `ref_context`, and reset to `None` in `after_content`,
nesting broke if you put anything after a nested class:
```rst
.. py:class:: Parent
.. py:method:: foo()
This wouldn't resolve: :py:meth:`bar`
.. py:class:: Child
In the `after_content` method, the object is reset to `None`, so
anything after this in the same nesting is considered to be top level
instead.
.. py:method:: bar()
This is top level, as the domain thinks the surrounding object is `None`
```
This depends on #3519 and can be rebased after that is merged into stable
Fixes#3065
Refs #3067