summaryrefslogtreecommitdiffstats
path: root/Demo/embed/importexc.c
blob: 59b1d01d87be31cbca494624745969bb88c162ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#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;
}