# Buggy code
def match(self, interp, block, typemap, calltypes):
    """
    Using typing and a basic block, search the basic block for array
    expressions.
    Return True when one or more matches were found, False otherwise.
    """
    # We can trivially reject everything if there are no
    # calls in the type results.
    if len(calltypes) == 0:
        return False

    self.crnt_block = block
    self.typemap = typemap
    # { variable name: IR assignment (of a function call or operator) }
    self.array_assigns = OrderedDict()
    # { variable name: IR assignment (of a constant) }
    self.const_assigns = {}

    assignments = block.find_insts(ir.Assign)
    for instr in assignments:
        target_name = instr.target.name
        expr = instr.value
        # Does it assign an expression to an array variable?
        if isinstance(expr, ir.Expr) and isinstance(
            typemap.get(target_name, None), types.Array
        ):
            self._match_array_expr(instr, expr, target_name)
        elif isinstance(expr, ir.Const):
            # Track constants since we might need them for an
            # array expression.
            self.const_assigns[target_name] = expr

    return len(self.array_assigns) > 0


# Traceback (TypeError)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-15-3b23f7331ceb> in <module>()
----> 1 @jit(arg_types=[numba.double], ret_type=numba.double)
2 def is_REALLY_five(some_value):
3     for i in range(5):
4         if some_value == 5.0:
5             return 1.0

/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/numba/decorators.pyc in _jit(func)
77                   "garbage collected!" % (func,))
78         t = Translate(func, *args, **kws)
---> 79         t.translate()
80         __tr_map__[func] = t
81         return t.get_ctypes_func(llvm)

/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/numba/translate.pyc in translate(self)
926                     # Ensure we are playing with locals that might
927                     # actually precede the next block.
--> 928                     self.check_locals(i)
929
930                 self.crnt_block = i

/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/numba/translate.pyc in check_locals(self, i)
1135                 else:
1136                     assert next_locals is not None, "Internal compiler error!"
-> 1137             self._locals = next_locals[:]
1138
1139     def get_ctypes_func(self, llvm=True):

TypeError: 'NoneType' object has no attribute '__getitem__'

# Fixed code
def match(self, func_ir, block, typemap, calltypes):
    """
    Using typing and a basic block, search the basic block for array
    expressions.
    Return True when one or more matches were found, False otherwise.
    """
    # We can trivially reject everything if there are no
    # calls in the type results.
    if len(calltypes) == 0:
        return False

    self.crnt_block = block
    self.typemap = typemap
    # { variable name: IR assignment (of a function call or operator) }
    self.array_assigns = OrderedDict()
    # { variable name: IR assignment (of a constant) }
    self.const_assigns = {}

    assignments = block.find_insts(ir.Assign)
    for instr in assignments:
        target_name = instr.target.name
        expr = instr.value
        # Does it assign an expression to an array variable?
        if isinstance(expr, ir.Expr) and isinstance(
            typemap.get(target_name, None), types.Array
        ):
            self._match_array_expr(instr, expr, target_name)
        elif isinstance(expr, ir.Const):
            # Track constants since we might need them for an
            # array expression.
            self.const_assigns[target_name] = expr

    return len(self.array_assigns) > 0