Staging
v0.5.1
https://github.com/python/cpython
Raw File
Tip revision: 6ac3c7b58813bd9fb7447e4e52342c5306692a69 authored by cvs2svn on 23 January 2001, 01:57:40 UTC
This commit was manufactured by cvs2svn to create tag 'r21a1'.
Tip revision: 6ac3c7b
loop.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*/
}
back to top