# Buggy code
def depart_desc(self, node: Element) -> None:
    self.desc = None
    self.ensure_eol()
    self.body.append("@end deffn\n")


# Traceback (TypeError)
# Sphinx version: 3.1.2
# Python version: 3.8.3 (CPython)
# Docutils version: 0.16 release
# Jinja2 version: 2.11.1
# Last messages:
#   internals/authors
#   faq
#   glossary
#   changes
#   examples
#
#   resolving references...
#   done
#   writing...
#   failed
# Loaded extensions:
#   sphinx.ext.mathjax (3.1.2) from ~/.virtualenvs/python-3.8/lib/python3.8/site-packages/sphinx/ext/mathjax.py
#   sphinxcontrib.applehelp (1.0.2) from ~/.virtualenvs/python-3.8/lib/python3.8/site-packages/sphinxcontrib/applehelp/__init__.py
#   sphinxcontrib.devhelp (1.0.2) from ~/.virtualenvs/python-3.8/lib/python3.8/site-packages/sphinxcontrib/devhelp/__init__.py
#   sphinxcontrib.htmlhelp (1.0.3) from ~/.virtualenvs/python-3.8/lib/python3.8/site-packages/sphinxcontrib/htmlhelp/__init__.py
#   sphinxcontrib.serializinghtml (1.1.4) from ~/.virtualenvs/python-3.8/lib/python3.8/site-packages/sphinxcontrib/serializinghtml/__init__.py
#   sphinxcontrib.qthelp (1.0.3) from ~/.virtualenvs/python-3.8/lib/python3.8/site-packages/sphinxcontrib/qthelp/__init__.py
#   alabaster (0.7.12) from ~/.virtualenvs/python-3.8/lib/python3.8/site-packages/alabaster/__init__.py
#   sphinx.ext.autodoc.type_comment (3.1.2) from ~/.virtualenvs/python-3.8/lib/python3.8/site-packages/sphinx/ext/autodoc/type_comment.py
#   sphinx.ext.autodoc (3.1.2) from ~/.virtualenvs/python-3.8/lib/python3.8/site-packages/sphinx/ext/autodoc/__init__.py
#   sphinx.ext.doctest (3.1.2) from ~/.virtualenvs/python-3.8/lib/python3.8/site-packages/sphinx/ext/doctest.py
#   sphinx.ext.todo (3.1.2) from ~/.virtualenvs/python-3.8/lib/python3.8/site-packages/sphinx/ext/todo.py
#   sphinx.ext.autosummary (3.1.2) from ~/.virtualenvs/python-3.8/lib/python3.8/site-packages/sphinx/ext/autosummary/__init__.py
#   sphinx.ext.extlinks (3.1.2) from ~/.virtualenvs/python-3.8/lib/python3.8/site-packages/sphinx/ext/extlinks.py
#   sphinx.ext.intersphinx (3.1.2) from ~/.virtualenvs/python-3.8/lib/python3.8/site-packages/sphinx/ext/intersphinx.py
#   sphinx.ext.viewcode (3.1.2) from ~/.virtualenvs/python-3.8/lib/python3.8/site-packages/sphinx/ext/viewcode.py
#   sphinx.ext.graphviz (3.1.2) from ~/.virtualenvs/python-3.8/lib/python3.8/site-packages/sphinx/ext/graphviz.py
#   sphinx.ext.inheritance_diagram (3.1.2) from ~/.virtualenvs/python-3.8/lib/python3.8/site-packages/sphinx/ext/inheritance_diagram.py
Traceback (most recent call last):
File "~/.virtualenvs/python-3.8/lib/python3.8/site-packages/sphinx/cmd/build.py", line 280, in build_main
app.build(args.force_all, filenames)
File "~/.virtualenvs/python-3.8/lib/python3.8/site-packages/sphinx/application.py", line 348, in build
self.builder.build_update()
File "~/.virtualenvs/python-3.8/lib/python3.8/site-packages/sphinx/builders/__init__.py", line 294, in build_update
self.build(['__all__'], to_build)
File "~/.virtualenvs/python-3.8/lib/python3.8/site-packages/sphinx/builders/__init__.py", line 361, in build
self.write(docnames, list(updated_docnames), method)
File "~/.virtualenvs/python-3.8/lib/python3.8/site-packages/sphinx/builders/texinfo.py", line 127, in write
docwriter.write(doctree, destination)
File "~/.virtualenvs/python-3.8/lib/python3.8/site-packages/docutils/writers/__init__.py", line 78, in write
self.translate()
File "~/.virtualenvs/python-3.8/lib/python3.8/site-packages/sphinx/writers/texinfo.py", line 140, in translate
self.document.walkabout(visitor)
File "~/.virtualenvs/python-3.8/lib/python3.8/site-packages/docutils/nodes.py", line 214, in walkabout
if child.walkabout(visitor):
File "~/.virtualenvs/python-3.8/lib/python3.8/site-packages/docutils/nodes.py", line 214, in walkabout
if child.walkabout(visitor):
File "~/.virtualenvs/python-3.8/lib/python3.8/site-packages/docutils/nodes.py", line 214, in walkabout
if child.walkabout(visitor):
[Previous line repeated 13 more times]
File "~/.virtualenvs/python-3.8/lib/python3.8/site-packages/docutils/nodes.py", line 206, in walkabout
visitor.dispatch_visit(self)
File "~/.virtualenvs/python-3.8/lib/python3.8/site-packages/sphinx/util/docutils.py", line 468, in dispatch_visit
method(node)
File "~/.virtualenvs/python-3.8/lib/python3.8/site-packages/sphinx/writers/texinfo.py", line 1457, in visit_desc_annotation
if txt == self.desc['desctype'] or \
TypeError: 'NoneType' object is not subscriptable

# Fixed code
def depart_desc(self, node: addnodes.desc) -> None:
    self.descs.pop()
    self.ensure_eol()
    self.body.append("@end deffn\n")