]> granicus.if.org Git - python/commitdiff
Simple embedded program that does a module import. Useful for
authorBarry Warsaw <barry@python.org>
Wed, 31 Jan 2001 22:27:51 +0000 (22:27 +0000)
committerBarry Warsaw <barry@python.org>
Wed, 31 Jan 2001 22:27:51 +0000 (22:27 +0000)
debugging leaks and other memory problems.

Demo/embed/import.c [new file with mode: 0644]

diff --git a/Demo/embed/import.c b/Demo/embed/import.c
new file mode 100644 (file)
index 0000000..375ce1b
--- /dev/null
@@ -0,0 +1,17 @@
+#include <Python.h>
+
+char* cmd = "import exceptions";
+
+int main()
+{
+       Py_Initialize();
+       PyEval_InitThreads();
+       PyRun_SimpleString(cmd);
+       Py_EndInterpreter(PyThreadState_Get());
+
+       Py_NewInterpreter();
+       PyRun_SimpleString(cmd);
+       Py_Finalize();
+
+       return 0;
+}