2001-01-10 13:11:51 -04:00
|
|
|
/* 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)
|
|
|
|
{
|
2010-05-09 13:14:21 -03:00
|
|
|
int count = -1;
|
|
|
|
char *command;
|
2001-01-10 13:11:51 -04:00
|
|
|
|
2010-05-09 13:14:21 -03:00
|
|
|
if (argc < 2 || argc > 3) {
|
|
|
|
fprintf(stderr, "usage: loop <python-command> [count]\n");
|
|
|
|
exit(2);
|
|
|
|
}
|
|
|
|
command = argv[1];
|
2001-01-10 13:11:51 -04:00
|
|
|
|
2010-05-09 13:14:21 -03:00
|
|
|
if (argc == 3) {
|
|
|
|
count = atoi(argv[2]);
|
|
|
|
}
|
2001-01-23 12:42:01 -04:00
|
|
|
|
Merged revisions 83393,83396,83398,83404-83405,83408 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k
........
r83393 | georg.brandl | 2010-08-01 10:35:29 +0200 (So, 01 Aug 2010) | 1 line
#1690103: fix initial namespace for code run with trace.main().
........
r83396 | georg.brandl | 2010-08-01 10:52:32 +0200 (So, 01 Aug 2010) | 1 line
#4810: document "--" option separator in timeit help.
........
r83398 | georg.brandl | 2010-08-01 11:06:34 +0200 (So, 01 Aug 2010) | 1 line
#8826: the "expires" attribute value is a date string with spaces, but apparently not all user-agents put it in quotes. Handle that as a special case.
........
r83404 | georg.brandl | 2010-08-01 16:25:22 +0200 (So, 01 Aug 2010) | 1 line
#6439: fix argument type for PySys_SetArgvEx() and Py_SetProgramName() in Demo/embed code.
........
r83405 | georg.brandl | 2010-08-01 16:38:17 +0200 (So, 01 Aug 2010) | 1 line
#4943: do not try to include drive letters (and colons) when looking for a probably module name.
........
r83408 | georg.brandl | 2010-08-01 17:30:56 +0200 (So, 01 Aug 2010) | 1 line
#5551: symbolic links never can be mount points. Fixes the fix for #1713.
........
2010-08-01 15:56:30 -03:00
|
|
|
Py_SetProgramName(L"loop");
|
2001-01-10 13:11:51 -04:00
|
|
|
|
2010-05-09 13:14:21 -03:00
|
|
|
/* uncomment this if you don't want to load site.py */
|
|
|
|
/* Py_NoSiteFlag = 1; */
|
2001-01-23 12:42:01 -04:00
|
|
|
|
2010-05-09 13:14:21 -03:00
|
|
|
while (count == -1 || --count >= 0 ) {
|
|
|
|
Py_Initialize();
|
|
|
|
PyRun_SimpleString(command);
|
|
|
|
Py_Finalize();
|
|
|
|
}
|
|
|
|
return 0;
|
2001-01-10 13:11:51 -04:00
|
|
|
}
|