cpython/Demo/embed/importexc.c
Christian Heimes 6a27efa2d3 Issue 3723: Fixed initialization of subinterpreters
The patch fixes several issues with Py_NewInterpreter as well as the demo for multiple subinterpreters.
Most of the patch was written by MvL with help from Benjamin, Amaury and me. Graham Dumpleton has verified that this patch fixes an issue with mod_wsgi.
2008-10-30 21:48:26 +00:00

23 lines
429 B
C

#include <Python.h>
#if 0
char* cmd = "import codecs, encodings.utf_8, types; print(types)";
#else
char* cmd = "import types; print(types)";
#endif
int main()
{
printf("Initialize interpreter\n");
Py_Initialize();
PyEval_InitThreads();
PyRun_SimpleString(cmd);
Py_EndInterpreter(PyThreadState_Get());
printf("\nInitialize subinterpreter\n");
Py_NewInterpreter();
PyRun_SimpleString(cmd);
Py_Finalize();
return 0;
}