Remove function pointer calls from Python wrappers
There were two places where the wrappers directly called Python
functions via function pointers. This resulted in undefined
behavior warning from UBSan. Now the function pointers are
wrapped in PyCFunction
objects and called indirectly.