I think sys is appropriate for clearing the cache. Lib/test/regrtest.py
still has a reference to gc rather than sys.
Why do the CompactFreeList APIs return an int that is always 0? Seems
like they should return a real value or be void.
I'm not sure why you changed the functions to keep a block_list_length.
I doubt this API would be requested very often. Seems like it would be
better to just calculate when necessary (or perhaps not even add the APIs).
The only issue I have with the patch is the casting in the printf calls.
These can lose information. On Win64, long is 32-bits, but size_t is
64-bits. See PY_FORMAT_SIZE_T in Include/pyport.h for how to handle this.