def test_issue7507(self):
        """
        Test a problem with BaseContext.get_function() because of changes
        related to the new style error handling.
        """
        from numba.core.typing.templates import AbstractTemplate, infer_global
        from numba.core.imputils import lower_builtin

        @infer_global(issue7507_lround)
        class lroundTemplate(AbstractTemplate):
            key = issue7507_lround

            def generic(self, args, kws):
                signature = types.int64(types.float64)

                # insert a new builtin during the compilation process
                @lower_builtin(issue7507_lround, types.float64)
                def codegen(context, builder, sig, args):
                    # Simply truncate with the cast to integer.
                    return context.cast(builder, args[0], sig.args[0],
                                        sig.return_type)

                return signature

        @njit('int64(float64)')
        def foo(a):
            return issue7507_lround(a)

        self.assertEqual(foo(3.4), 3)

        Test a problem with BaseContext.get_function() because of changes
        related to the new style error handling.
        
numba/tests/test_practical_lowering_issues.py