Esempio n. 1
0
def test_record_exact_value():
    class A(object):
        pass

    a = A()
    b = A()
    record_exact_value(a, a)  # assume not crash
    with pytest.raises(AssertionError):
        record_exact_value(a, b)
Esempio n. 2
0
File: rstr.py Progetto: Mu-L/pypy
    def ll_rfind(s1, s2, start, end):
        from rpython.rlib.rstring import SEARCH_RFIND
        if start < 0:
            start = 0
        if end > len(s1.chars):
            end = len(s1.chars)
        if end - start < 0:
            return -1

        m = len(s2.chars)
        if m <= 1:
            if m == 0:
                return end
            res = LLHelpers.ll_rfind_char(s1, s2.chars[0], start, end)
            jit.record_exact_value(res < end, True)
            return res

        res = LLHelpers.ll_search(s1, s2, start, end, SEARCH_RFIND)
        jit.record_exact_value(res < end, True)
        return res
Esempio n. 3
0
 def g():
     a = f()
     record_exact_value(a >= 0, True)  # does not crash
Esempio n. 4
0
 def g(j):
     a = make(j)
     record_exact_value(a, None)
Esempio n. 5
0
 def g():
     a = A()
     b = A()
     record_exact_value(a, a)  # assume not crash