summaryrefslogtreecommitdiffstats
path: root/Demo/embed
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2001-01-31 22:27:51 (GMT)
committerBarry Warsaw <barry@python.org>2001-01-31 22:27:51 (GMT)
commitf9abaf42f840cb5c3c60a1052177209072b885cb (patch)
treee8bf2149336a117dc920c9a66af434d3ea552345 /Demo/embed
parent2df3c41e78cb77ac940cb8e0950a5d0c67c95508 (diff)
downloadcpython-f9abaf42f840cb5c3c60a1052177209072b885cb.zip
cpython-f9abaf42f840cb5c3c60a1052177209072b885cb.tar.gz
cpython-f9abaf42f840cb5c3c60a1052177209072b885cb.tar.bz2
Simple embedded program that does a module import. Useful for
debugging leaks and other memory problems.
Diffstat (limited to 'Demo/embed')
-rw-r--r--Demo/embed/import.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/Demo/embed/import.c b/Demo/embed/import.c
new file mode 100644
index 0000000..375ce1b
--- /dev/null
+++ b/Demo/embed/import.c
@@ -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;
+}