# Buggy code
def format_signature(self, **kwargs: Any) -> str:
    """Format the signature (arguments and return annotation) of the object.

    Let the user process it via the ``autodoc-process-signature`` event.
    """
    if self.args is not None:
        # signature given explicitly
        args = "(%s)" % self.args
        retann = self.retann
    else:
        # try to introspect the signature
        try:
            retann = None
            args = self._call_format_args(**kwargs)
            if args:
                matched = re.match(r"^(\(.*\))\s+->\s+(.*)$", args)
                if matched:
                    args = matched.group(1)
                    retann = matched.group(2)
        except Exception:
            logger.warning(
                __("error while formatting arguments for %s:") % self.fullname,
                type="autodoc",
                exc_info=True,
            )
            args = None

    result = self.env.events.emit_firstresult(
        "autodoc-process-signature",
        self.objtype,
        self.fullname,
        self.object,
        self.options,
        args,
        retann,
    )
    if result:
        args, retann = result

    if args is not None:
        return args + ((" -> %s" % retann) if retann else "")
    else:
        return ""


# Traceback (TypeError)
Process Process-2:
Traceback (most recent call last):
File "/usr/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/usr/lib/python3.6/multiprocessing/process.py", line 93, in run
self._target(*self._args, **self._kwargs)
File "/home/robsan00/venv/python3/lib/python3.6/site-packages/sphinx/util/parallel.py", line 91, in _process
pipe.send((failed, collector.logs, ret))
File "/usr/lib/python3.6/multiprocessing/connection.py", line 206, in send
self._send_bytes(_ForkingPickler.dumps(obj))
File "/usr/lib/python3.6/multiprocessing/reduction.py", line 51, in dumps
cls(buf, protocol).dump(obj)
TypeError: can't pickle traceback objects

Exception occurred:
File "/usr/lib/python3.6/multiprocessing/connection.py", line 383, in _recv
raise EOFError
EOFError
The full traceback has been saved in /tmp/sphinx-err-4oh9kpix.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!
Process Process-6:
(...)

# Fixed code
def format_signature(self, **kwargs: Any) -> str:
    """Format the signature (arguments and return annotation) of the object.

    Let the user process it via the ``autodoc-process-signature`` event.
    """
    if self.args is not None:
        # signature given explicitly
        args = "(%s)" % self.args
        retann = self.retann
    else:
        # try to introspect the signature
        try:
            retann = None
            args = self._call_format_args(**kwargs)
            if args:
                matched = re.match(r"^(\(.*\))\s+->\s+(.*)$", args)
                if matched:
                    args = matched.group(1)
                    retann = matched.group(2)
        except Exception as exc:
            logger.warning(
                __("error while formatting arguments for %s: %s"),
                self.fullname,
                exc,
                type="autodoc",
            )
            args = None

    result = self.env.events.emit_firstresult(
        "autodoc-process-signature",
        self.objtype,
        self.fullname,
        self.object,
        self.options,
        args,
        retann,
    )
    if result:
        args, retann = result

    if args is not None:
        return args + ((" -> %s" % retann) if retann else "")
    else:
        return ""