I'm very interested in using Cython to write C extensions for SQLite. I was able to use Cython so long as everything stayed "in C", but as soon as Cython tried to acquire the GIL I'd get a segfault.
Turns out the problem could be fixed by hand-hacking the generated C source file and explicitly calling `Py_Initialize()` and the generated module init function, `init<mymodule>`.
I was reading the docs and there's a section that mentions external C code must be responsible for calling Py_Initialize() and Py_Finalize(), but is there a way I can embed this logic in the Cython module itself?
If it helps, SQLite extensions have a well-defined entrypoint. I opened up the C source and, towards the end of the generated SQLite entry-point, I added my calls to Py_Initialize() and init<mymodule>(). Can I write that initialization logic in Cython rather than having to hand-hack it into the generated file?
Any help is very appreciated.