python: get rid of heap allocation of entries, and make test_cons_leak more rigorous