Barry Warsaw | f9abaf4 | 2001-01-31 22:27:51 +0000 | [diff] [blame] | 1 | #include <Python.h> |
| 2 | |
Christian Heimes | 6a27efa | 2008-10-30 21:48:26 +0000 | [diff] [blame] | 3 | #if 0 |
| 4 | char* cmd = "import codecs, encodings.utf_8, types; print(types)"; |
| 5 | #else |
| 6 | char* cmd = "import types; print(types)"; |
| 7 | #endif |
Barry Warsaw | f9abaf4 | 2001-01-31 22:27:51 +0000 | [diff] [blame] | 8 | |
| 9 | int main() |
| 10 | { |
Christian Heimes | 6a27efa | 2008-10-30 21:48:26 +0000 | [diff] [blame] | 11 | printf("Initialize interpreter\n"); |
Barry Warsaw | f9abaf4 | 2001-01-31 22:27:51 +0000 | [diff] [blame] | 12 | Py_Initialize(); |
| 13 | PyEval_InitThreads(); |
| 14 | PyRun_SimpleString(cmd); |
| 15 | Py_EndInterpreter(PyThreadState_Get()); |
| 16 | |
Christian Heimes | 6a27efa | 2008-10-30 21:48:26 +0000 | [diff] [blame] | 17 | printf("\nInitialize subinterpreter\n"); |
Barry Warsaw | f9abaf4 | 2001-01-31 22:27:51 +0000 | [diff] [blame] | 18 | Py_NewInterpreter(); |
| 19 | PyRun_SimpleString(cmd); |
| 20 | Py_Finalize(); |
| 21 | |
| 22 | return 0; |
| 23 | } |