Issue #7251: Break out round tests for large values into a separate
[python.git] / Demo / embed / loop.c
blobd5af82986d66f8dae782d00a9199c664e3b90533
1 /* Simple program that repeatedly calls Py_Initialize(), does something, and
2 then calls Py_Finalize(). This should help finding leaks related to
3 initialization. */
5 #include "Python.h"
7 main(int argc, char **argv)
9 int count = -1;
10 char *command;
12 if (argc < 2 || argc > 3) {
13 fprintf(stderr, "usage: loop <python-command> [count]\n");
14 exit(2);
16 command = argv[1];
18 if (argc == 3) {
19 count = atoi(argv[2]);
22 Py_SetProgramName(argv[0]);
24 /* uncomment this if you don't want to load site.py */
25 /* Py_NoSiteFlag = 1; */
27 while (count == -1 || --count >= 0 ) {
28 Py_Initialize();
29 PyRun_SimpleString(command);
30 Py_Finalize();
32 return 0;