Python not finalized when using embedding
When using cffi in embedding mode, cffi does not offer a way to call Py_Finalize
. This is important because Python flushes and closes stdin
and stdout
there (and maybe runs additional cleanup code). My current workaround is to add some additional code to the generated source file:
#ifdef PYPY_VERSION
void cffi_finalize() { }
#else
void cffi_finalize() {
PyGILState_Ensure();
Py_Finalize();
}
#endif
It would be nice to have cffi automatically generate something like this. I do not know in how far embedding with pypy is affected by this.