/* Test multiple reinitializations of the interpreter
 */

#include "Python.h"

#define ROUNDS 10
#undef CAUSE_SEGFAULT
#undef VERBOSE

int main(void) {
	int i;
#ifdef VERBOSE
	Py_VerboseFlag++;
#endif

	for (i=0; i < ROUNDS; i++) {
		fprintf(stderr, "round %d ", i+1); fflush(stderr);

		Py_Initialize();
		fprintf(stderr, "up\n"); fflush(stderr);

#ifdef CAUSE_SEGFAULT
	        Py_DECREF(PySys_GetObject("float_info"));
#endif

		Py_Finalize();
		fprintf(stderr, "... down\n"); fflush(stderr);
	}
	return 0;
}


