def test_specialize_decorator(): def f(): pass specialize.memo()(f) assert f._annspecialcase_ == 'specialize:memo' specialize.arg(0)(f) assert f._annspecialcase_ == 'specialize:arg(0)' specialize.arg(1)(f) assert f._annspecialcase_ == 'specialize:arg(1)'
def __init__(self, space): if self.built: return self.built = True cache = {} for cls, it in all_types._items: if it == 'complex': cache[cls] = make_sort_function(space, cls, it, 2) else: cache[cls] = make_sort_function(space, cls, it) self.cache = cache self._lookup = specialize.memo()(lambda tp: cache[tp[0]])