mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Simple embedded program that does a module import. Useful for
debugging leaks and other memory problems.
This commit is contained in:
parent
2df3c41e78
commit
f9abaf42f8
1 changed files with 17 additions and 0 deletions
17
Demo/embed/import.c
Normal file
17
Demo/embed/import.c
Normal file
|
|
@ -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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue