# Buggy code
def add_object_type(
    self,
    directivename,
    rolename,
    indextemplate="",
    parse_node=None,
    ref_nodeclass=None,
    objname="",
    doc_field_types=[],
    override=False,
):
    # type: (str, str, str, Callable, Type[nodes.TextElement], str, List, bool) -> None
    """Register a new object type.

    This method is a very convenient way to add a new :term:`object` type
    that can be cross-referenced.  It will do this:

    - Create a new directive (called *directivename*) for documenting an
      object.  It will automatically add index entries if *indextemplate*
      is nonempty; if given, it must contain exactly one instance of
      ``%s``.  See the example below for how the template will be
      interpreted.
    - Create a new role (called *rolename*) to cross-reference to these
      object descriptions.
    - If you provide *parse_node*, it must be a function that takes a
      string and a docutils node, and it must populate the node with
      children parsed from the string.  It must then return the name of the
      item to be used in cross-referencing and index entries.  See the
      :file:`conf.py` file in the source for this documentation for an
      example.
    - The *objname* (if not given, will default to *directivename*) names
      the type of object.  It is used when listing objects, e.g. in search
      results.

    For example, if you have this call in a custom Sphinx extension::

       app.add_object_type('directive', 'dir', 'pair: %s; directive')

    you can use this markup in your documents::

       .. rst:directive:: function

          Document a function.

       <...>

       See also the :rst:dir:`function` directive.

    For the directive, an index entry will be generated as if you had prepended ::

       .. index:: pair: function; directive

    The reference node will be of class ``literal`` (so it will be rendered
    in a proportional font, as appropriate for code) unless you give the
    *ref_nodeclass* argument, which must be a docutils node class.  Most
    useful are ``docutils.nodes.emphasis`` or ``docutils.nodes.strong`` --
    you can also use ``docutils.nodes.generated`` if you want no further
    text decoration.  If the text should be treated as literal (e.g. no
    smart quote replacement), but not have typewriter styling, use
    ``sphinx.addnodes.literal_emphasis`` or
    ``sphinx.addnodes.literal_strong``.

    For the role content, you have the same syntactical possibilities as
    for standard Sphinx roles (see :ref:`xref-syntax`).

    This method is also available under the deprecated alias
    :meth:`add_description_unit`.

    .. versionchanged:: 1.8
       Add *override* keyword.
    """
    self.registry.add_object_type(
        directivename,
        rolename,
        indextemplate,
        parse_node,
        ref_nodeclass,
        objname,
        doc_field_types,
        override=override,
    )


# Traceback (AttributeError)
[tmp]$ git clone https://github.com/pytest-dev/pytest.git
...
[tmp]$ cd pytest
[tmp]$ git rev-parse HEAD
51bf7c3aef8f018f44e7c36378be894aa13e32b5
[pytest (master)]$ python3.7 -m venv __venv__
[pytest (master)]$ . __venv__/bin/activate
(__venv__) [pytest (master)]$ pip install --pre sphinx
...
Successfully installed Jinja2-2.10 MarkupSafe-1.1.1 Pygments-2.3.1 alabaster-0.7.12 babel-2.6.0 certifi-2019.3.9 chardet-3.0.4 docutils-0.14 idna-2.8 imagesize-1.1.0 packaging-19.0 pyparsing-2.3.1 pytz-2018.9 requests-2.21.0 six-1.12.0 snowballstemmer-1.2.1 sphinx-2.0.0b1 sphinxcontrib-applehelp-1.0.1 sphinxcontrib-devhelp-1.0.1 sphinxcontrib-htmlhelp-1.0.1 sphinxcontrib-jsmath-1.0.1 sphinxcontrib-qthelp-1.0.2 sphinxcontrib-serializinghtml-1.1.1 urllib3-1.24.1
(__venv__) [pytest (master)]$ cd doc/en
(__venv__) [en (master)]$ pip install -r requirements.txt
...
Successfully installed pygments-pytest-1.2.0 sphinx-removed-in-0.1.3 sphinxcontrib-trio-1.0.2
(__venv__) [en (master)]$ pip install ../..
...
Successfully installed atomicwrites-1.3.0 attrs-19.1.0 more-itertools-6.0.0 pluggy-0.9.0 py-1.8.0 pytest-4.3.1.dev110+g51bf7c3a
(__venv__) [en (master)]$ sphinx-build -W -b html . _build
Running Sphinx v2.0.0b1
making output directory... done

Exception occurred:
File "/home/churchyard/tmp/pytest/doc/en/conf.py", line 338, in setup
app.add_description_unit(
AttributeError: 'Sphinx' object has no attribute 'add_description_unit'
The full traceback has been saved in /tmp/sphinx-err-k3n0s9df.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
(__venv__) [en (master)]$ cat /tmp/sphinx-err-k3n0s9df.log
# Sphinx version: 2.0.0b1
# Python version: 3.7.2 (CPython)
# Docutils version: 0.14
# Jinja2 version: 2.10
# Last messages:

# Loaded extensions:
Traceback (most recent call last):
File "/home/churchyard/tmp/pytest/__venv__/lib64/python3.7/site-packages/sphinx/cmd/build.py", line 283, in build_main
args.tags, args.verbosity, args.jobs, args.keep_going)
File "/home/churchyard/tmp/pytest/__venv__/lib64/python3.7/site-packages/sphinx/application.py", line 242, in __init__
self.config.setup(self)
File "/home/churchyard/tmp/pytest/doc/en/conf.py", line 338, in setup
app.add_description_unit(
AttributeError: 'Sphinx' object has no attribute 'add_description_unit'

# Fixed code
def add_object_type(
    self,
    directivename,
    rolename,
    indextemplate="",
    parse_node=None,
    ref_nodeclass=None,
    objname="",
    doc_field_types=[],
    override=False,
):
    # type: (str, str, str, Callable, Type[nodes.TextElement], str, List, bool) -> None
    """Register a new object type.

    This method is a very convenient way to add a new :term:`object` type
    that can be cross-referenced.  It will do this:

    - Create a new directive (called *directivename*) for documenting an
      object.  It will automatically add index entries if *indextemplate*
      is nonempty; if given, it must contain exactly one instance of
      ``%s``.  See the example below for how the template will be
      interpreted.
    - Create a new role (called *rolename*) to cross-reference to these
      object descriptions.
    - If you provide *parse_node*, it must be a function that takes a
      string and a docutils node, and it must populate the node with
      children parsed from the string.  It must then return the name of the
      item to be used in cross-referencing and index entries.  See the
      :file:`conf.py` file in the source for this documentation for an
      example.
    - The *objname* (if not given, will default to *directivename*) names
      the type of object.  It is used when listing objects, e.g. in search
      results.

    For example, if you have this call in a custom Sphinx extension::

       app.add_object_type('directive', 'dir', 'pair: %s; directive')

    you can use this markup in your documents::

       .. rst:directive:: function

          Document a function.

       <...>

       See also the :rst:dir:`function` directive.

    For the directive, an index entry will be generated as if you had prepended ::

       .. index:: pair: function; directive

    The reference node will be of class ``literal`` (so it will be rendered
    in a proportional font, as appropriate for code) unless you give the
    *ref_nodeclass* argument, which must be a docutils node class.  Most
    useful are ``docutils.nodes.emphasis`` or ``docutils.nodes.strong`` --
    you can also use ``docutils.nodes.generated`` if you want no further
    text decoration.  If the text should be treated as literal (e.g. no
    smart quote replacement), but not have typewriter styling, use
    ``sphinx.addnodes.literal_emphasis`` or
    ``sphinx.addnodes.literal_strong``.

    For the role content, you have the same syntactical possibilities as
    for standard Sphinx roles (see :ref:`xref-syntax`).

    .. versionchanged:: 1.8
       Add *override* keyword.
    """
    self.registry.add_object_type(
        directivename,
        rolename,
        indextemplate,
        parse_node,
        ref_nodeclass,
        objname,
        doc_field_types,
        override=override,
    )