[pypy-dev] expected_extra_mallocs

Simon Burton simon at arrowtheory.com
Tue Jul 17 17:02:53 CEST 2007


Here is a little test:

def func():
    x = 1.
    print x

def test_1():
    from pypy.translator.c.test.test_genc import compile
    _func = compile(func, [])
    _func()


I get this error:

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    def checking_fn(*args, **kwds):
        if 'expected_extra_mallocs' in kwds:
            expected_extra_mallocs = kwds.pop('expected_extra_mallocs')
        else:
            expected_extra_mallocs = 0
        res = compiled_fn(*args, **kwds)
        mallocs, frees = module.malloc_counters()
E       assert mallocs - frees == expected_extra_mallocs
>       assert (6 - 5) == 0

[/home/simon/local/pypy-latest/pypy/translator/c/test/test_genc.py:54]


So, do I call this with expected_extra_mallocs=1 ?
In general, how many extra mallocs should I expect ?

Simon.







More information about the Pypy-dev mailing list