# Buggy code
def format_args(self, **kwargs: Any) -> str:
    if self.env.config.autodoc_typehints in ("none", "description"):
        kwargs.setdefault("show_annotation", False)

    unwrapped = inspect.unwrap(self.object)
    try:
        if self.object == object.__init__ and self.parent != object:
            # Classes not having own __init__() method are shown as no arguments.
            #
            # Note: The signature of object.__init__() is (self, /, *args, **kwargs).
            #       But it makes users confused.
            args = "()"
        else:
            if inspect.isstaticmethod(
                unwrapped, cls=self.parent, name=self.object_name
            ):
                self.env.app.emit("autodoc-before-process-signature", unwrapped, False)
                sig = inspect.signature(unwrapped, bound_method=False)
            else:
                self.env.app.emit("autodoc-before-process-signature", unwrapped, True)
                sig = inspect.signature(unwrapped, bound_method=True)
            args = stringify_signature(sig, **kwargs)
    except ValueError:
        args = ""

    if self.env.config.strip_signature_backslash:
        # escape backslashes for reST
        args = args.replace("\\", "\\\\")
    return args


# Traceback (TypeError)
WARNING: error while formatting arguments for errno.EINTR:
Traceback (most recent call last):
File "/Users/tkomiya/work/sphinx/sphinx/ext/autodoc/__init__.py", line 1049, in format_args
sig = inspect.signature(unwrapped)
File "/Users/tkomiya/work/sphinx/sphinx/util/inspect.py", line 406, in signature
signature = inspect.signature(subject)
File "/Users/tkomiya/.pyenv/versions/3.8.2/lib/python3.8/inspect.py", line 3093, in signature
return Signature.from_callable(obj, follow_wrapped=follow_wrapped)
File "/Users/tkomiya/.pyenv/versions/3.8.2/lib/python3.8/inspect.py", line 2842, in from_callable
return _signature_from_callable(obj, sigcls=cls,
File "/Users/tkomiya/.pyenv/versions/3.8.2/lib/python3.8/inspect.py", line 2216, in _signature_from_callable
raise TypeError('{!r} is not a callable object'.format(obj))
TypeError: 4 is not a callable object

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/tkomiya/work/sphinx/sphinx/ext/autodoc/__init__.py", line 395, in format_signature
args = self.format_args(**kwargs)
File "/Users/tkomiya/work/sphinx/sphinx/ext/autodoc/__init__.py", line 1052, in format_args
if (inspect.is_builtin_class_method(unwrapped, '__new__') and
File "/Users/tkomiya/work/sphinx/sphinx/util/inspect.py", line 392, in is_builtin_class_method
classes = [c for c in inspect.getmro(obj) if attr_name in c.__dict__]
File "/Users/tkomiya/.pyenv/versions/3.8.2/lib/python3.8/inspect.py", line 489, in getmro
return cls.__mro__
AttributeError: 'int' object has no attribute '__mro__'

# Fixed code
def format_args(self, **kwargs: Any) -> str:
    if self.env.config.autodoc_typehints in ("none", "description"):
        kwargs.setdefault("show_annotation", False)

    unwrapped = inspect.unwrap(self.object)
    try:
        if self.object == object.__init__ and self.parent != object:
            # Classes not having own __init__() method are shown as no arguments.
            #
            # Note: The signature of object.__init__() is (self, /, *args, **kwargs).
            #       But it makes users confused.
            args = "()"
        else:
            if inspect.isstaticmethod(
                unwrapped, cls=self.parent, name=self.object_name
            ):
                self.env.app.emit("autodoc-before-process-signature", unwrapped, False)
                sig = inspect.signature(unwrapped, bound_method=False)
            else:
                self.env.app.emit("autodoc-before-process-signature", unwrapped, True)
                sig = inspect.signature(unwrapped, bound_method=True)
            args = stringify_signature(sig, **kwargs)
    except TypeError as exc:
        logger.warning(
            __("Failed to get a method signature for %s: %s"), self.fullname, exc
        )
        return None
    except ValueError:
        args = ""

    if self.env.config.strip_signature_backslash:
        # escape backslashes for reST
        args = args.replace("\\", "\\\\")
    return args