# Buggy code
def _create_shape_signature(classes, num_inputs, num_reductions, args, func_sig):
    """Create shape signature for GUFunc"""
    num_inouts = len(args) - num_reductions
    # maximum class number for array shapes
    max_shape_num = max(sum([list(x) for x in classes.values()], []))
    if config.DEBUG_ARRAY_OPT:
        print("create_shape_signature = ", max_shape_num)
    gu_sin = []
    gu_sout = []
    count = 0
    syms_sin = ()
    for var, typ in zip(args, func_sig.args):
        # print("create_shape_signature: var = ", var, " typ = ", typ)
        count = count + 1
        if isinstance(typ, types.Array):
            if var in classes:
                var_shape = classes[var]
                assert len(var_shape) == typ.ndim
            else:
                var_shape = []
                for i in range(typ.ndim):
                    max_shape_num = max_shape_num + 1
                    var_shape.append(max_shape_num)
            # TODO: use prefix + class number instead of single char
            dim_syms = tuple([chr(97 + i) for i in var_shape])  # chr(97) = 'a'
        else:
            dim_syms = ()
        if count > num_inouts:
            # assume all reduction vars are scalar
            gu_sout.append(())
        elif count > num_inputs and all([s in syms_sin for s in dim_syms]):
            # only when dim_syms are found in gu_sin, we consider this as output
            gu_sout.append(dim_syms)
        else:
            gu_sin.append(dim_syms)
            syms_sin += dim_syms
    return (gu_sin, gu_sout)


# 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 _create_shape_signature(classes, num_inputs, num_reductions, args, func_sig):
    """Create shape signature for GUFunc"""
    num_inouts = len(args) - num_reductions
    # maximum class number for array shapes
    max_shape_num = max(sum([list(x) for x in classes.values()], [1]))
    if config.DEBUG_ARRAY_OPT:
        print("create_shape_signature = ", max_shape_num)
    gu_sin = []
    gu_sout = []
    count = 0
    syms_sin = ()
    for var, typ in zip(args, func_sig.args):
        # print("create_shape_signature: var = ", var, " typ = ", typ)
        count = count + 1
        if isinstance(typ, types.Array):
            if var in classes:
                var_shape = classes[var]
                assert len(var_shape) == typ.ndim
            else:
                var_shape = []
                for i in range(typ.ndim):
                    max_shape_num = max_shape_num + 1
                    var_shape.append(max_shape_num)
            # TODO: use prefix + class number instead of single char
            dim_syms = tuple([chr(97 + i) for i in var_shape])  # chr(97) = 'a'
        else:
            dim_syms = ()
        if count > num_inouts:
            # assume all reduction vars are scalar
            gu_sout.append(())
        elif count > num_inputs and all([s in syms_sin for s in dim_syms]):
            # only when dim_syms are found in gu_sin, we consider this as
            # output
            gu_sout.append(dim_syms)
        else:
            gu_sin.append(dim_syms)
            syms_sin += dim_syms
    return (gu_sin, gu_sout)