def get_func_body_first_lineno(pyfunc):
    """
    Look up the first line of function body using the file in
    ``pyfunc.__code__.co_filename``.

    Returns
    -------
    lineno : int; or None
        The first line number of the function body; or ``None`` if the first
        line cannot be determined.
    """
    co = pyfunc.__code__
    try:
        with open(co.co_filename) as fin:
            source = fin.read()
            offset = 0
    except (FileNotFoundError, OSError):
        try:
            lines, offset = inspect.getsourcelines(pyfunc)
            source = "".join(lines)
            offset = offset - 1
        except (OSError, TypeError):
            return None

    tree = ast.parse(textwrap.dedent(source))
    finder = FindDefFirstLine(co.co_name, co.co_firstlineno - offset)
    finder.visit(tree)
    if finder.first_stmt_line:
        return finder.first_stmt_line + offset
    else:
        # No first line found.
        return None

    Look up the first line of function body using the file in
    ``pyfunc.__code__.co_filename``.

    Returns
    -------
    lineno : int; or None
        The first line number of the function body; or ``None`` if the first
        line cannot be determined.
    
numba/misc/firstlinefinder.py