take a look at hpy, which is explicitly designing a better API for python C extensions. https://hpyproject.org/