Gate Cython calls to malloc/free behind Python ref-counted objects