cpython/Demo/embed/loop.c
Guido van Rossum 3559d1f9b3 Add loop.c -- a test program for repeatedly calling Py_Initialize()
and Py_Finalize().  It seems to dump core right now...
2001-01-10 17:11:51 +00:00

26 lines
478 B
C

/* Simple program that repeatedly calls Py_Initialize(), does something, and
then calls Py_Finalize(). This should help finding leaks related to
initialization. */
#include "Python.h"
main(int argc, char **argv)
{
char *command;
if (argc != 2) {
fprintf(stderr, "usage: loop <python-command>\n");
exit(2);
}
command = argv[1];
Py_SetProgramName(argv[0]);
while (1) {
Py_Initialize();
PyRun_SimpleString(command);
Py_Finalize();
}
/*NOTREACHED*/
}