PageRenderTime 79ms CodeModel.GetById 22ms app.highlight 41ms RepoModel.GetById 1ms app.codeStats 1ms

/Modules/main.c

http://unladen-swallow.googlecode.com/
C | 718 lines | 557 code | 86 blank | 75 comment | 157 complexity | 0730bab75d2a0975589a7aee3e9c9a7b MD5 | raw file
  1/* Python interpreter main program */
  2
  3#include "Python.h"
  4#include "osdefs.h"
  5#include "code.h" /* For CO_FUTURE_DIVISION */
  6#include "import.h"
  7
  8#ifdef __VMS
  9#include <unixlib.h>
 10#endif
 11
 12#if defined(MS_WINDOWS) || defined(__CYGWIN__)
 13#ifdef HAVE_FCNTL_H
 14#include <fcntl.h>
 15#endif
 16#endif
 17
 18#if (defined(PYOS_OS2) && !defined(PYCC_GCC)) || defined(MS_WINDOWS)
 19#define PYTHONHOMEHELP "<prefix>\\lib"
 20#else
 21#if defined(PYOS_OS2) && defined(PYCC_GCC)
 22#define PYTHONHOMEHELP "<prefix>/Lib"
 23#else
 24#define PYTHONHOMEHELP "<prefix>/pythonX.X"
 25#endif
 26#endif
 27
 28#include "pygetopt.h"
 29
 30#define COPYRIGHT \
 31    "Type \"help\", \"copyright\", \"credits\" or \"license\" " \
 32    "for more information."
 33
 34#ifdef __cplusplus
 35extern "C" {
 36#endif
 37
 38/* For Py_GetArgcArgv(); set by main() */
 39static char **orig_argv;
 40static int  orig_argc;
 41
 42/* command line options */
 43#define BASE_OPTS "3RbBc:dEg*hiX:Jm:O*Q:sStuUvVW:x?"
 44
 45#ifndef RISCOS
 46#define PROGRAM_OPTS BASE_OPTS
 47#else /*RISCOS*/
 48/* extra option saying that we are running under a special task window
 49   frontend; especially my_readline will behave different */
 50#define PROGRAM_OPTS BASE_OPTS "w"
 51/* corresponding flag */
 52extern int Py_RISCOSWimpFlag;
 53#endif /*RISCOS*/
 54
 55/* Short usage message (with %s for argv0) */
 56static char *usage_line =
 57"usage: %s [option] ... [-c cmd | -m mod | file | -] [arg] ...\n";
 58
 59/* Long usage message, split into parts < 512 bytes */
 60static char *usage_1 = "\
 61Options and arguments (and corresponding environment variables):\n\
 62-B     : don't write .py[co] files on import; also PYTHONDONTWRITEBYTECODE=x\n\
 63-c cmd : program passed in as string (terminates option list)\n\
 64-d     : debug output from parser; also PYTHONDEBUG=x\n\
 65-E     : ignore PYTHON* environment variables (such as PYTHONPATH)\n\
 66-h     : print this help message and exit (also --help)\n\
 67-i     : inspect interactively after running script; forces a prompt even\n\
 68         if stdin does not appear to be a terminal; also PYTHONINSPECT=x\n\
 69";
 70static char *usage_2 = "\
 71-m mod : run library module as a script (terminates option list)\n\
 72-O#    : optimize generated code; also PYTHONOPTIMIZE=x\n\
 73-Q arg : division options: -Qold (default), -Qwarn, -Qwarnall, -Qnew\n\
 74-s     : don't add user site directory to sys.path; also PYTHONNOUSERSITE\n\
 75-S     : don't imply 'import site' on initialization\n\
 76-t     : issue warnings about inconsistent tab usage (-tt: issue errors)\n\
 77";
 78static char *usage_3 = "\
 79-u     : unbuffered binary stdout and stderr; also PYTHONUNBUFFERED=x\n\
 80         see man page for details on internal buffering relating to '-u'\n\
 81-v     : verbose (trace import statements); also PYTHONVERBOSE=x\n\
 82         can be supplied multiple times to increase verbosity\n\
 83-V     : print the Python version number and exit (also --version)\n\
 84-W arg : warning control; arg is action:message:category:module:lineno\n\
 85-x     : skip first line of source, allowing use of non-Unix forms of #!cmd\n\
 86-Xjit=arg : control JIT compilation: -Xjit=whenhot (default), -Xjit=never,\n\
 87            -Xjit=always.\n\
 88";
 89#ifdef WITH_PY3K_WARNINGS
 90static char *usage_4 = "\
 91-3     : warn about Python 3.x incompatibilities that 2to3 cannot trivially fix\n";
 92#else
 93static char *usage_4 = "";
 94#endif
 95#ifdef Py_REF_DEBUG
 96static char *usage_5 = "\
 97-R     : show refcount information after execution\n";
 98#else
 99static char *usage_5 = "";
100#endif
101static char *usage_6 = "\
102file   : program read from script file\n\
103-      : program read from stdin (default; interactive mode if a tty)\n\
104arg ...: arguments passed to program in sys.argv[1:]\n\n\
105Other environment variables:\n\
106PYTHONSTARTUP: file executed on interactive startup (no default)\n\
107PYTHONPATH   : '%c'-separated list of directories prefixed to the\n\
108               default module search path.  The result is sys.path.\n\
109";
110static char *usage_7 = "\
111PYTHONHOME   : alternate <prefix> directory (or <prefix>%c<exec_prefix>).\n\
112               The default module search path uses %s.\n\
113PYTHONCASEOK : ignore case in 'import' statements (Windows).\n\
114PYTHONIOENCODING: Encoding[:errors] used for stdin/stdout/stderr.\n\
115";
116
117
118static int
119usage(int exitcode, char* program)
120{
121	FILE *f = exitcode ? stderr : stdout;
122
123	fprintf(f, usage_line, program);
124	if (exitcode)
125		fprintf(f, "Try `python -h' for more information.\n");
126	else {
127		/* Avoid calling fprintf() with a non-string-literal
128		   format and no other arguments, or some versions of gcc
129		   will complain. */
130		fprintf(f, "%s", usage_1);
131		fprintf(f, "%s", usage_2);
132		fprintf(f, "%s", usage_3);
133		fprintf(f, "%s", usage_4);
134		fprintf(f, "%s", usage_5);
135		fprintf(f, usage_6, DELIM);
136		fprintf(f, usage_7, DELIM, PYTHONHOMEHELP);
137	}
138#if defined(__VMS)
139	if (exitcode == 0) {
140		/* suppress 'error' message */
141		return 1;
142	}
143	else {
144		/* STS$M_INHIB_MSG + SS$_ABORT */
145		return 0x1000002c;
146	}
147#else
148	return exitcode;
149#endif
150	/*NOTREACHED*/
151}
152
153static void RunStartupFile(PyCompilerFlags *cf)
154{
155	char *startup = Py_GETENV("PYTHONSTARTUP");
156	if (startup != NULL && startup[0] != '\0') {
157		FILE *fp = fopen(startup, "r");
158		if (fp != NULL) {
159			(void) PyRun_SimpleFileExFlags(fp, startup, 0, cf);
160			PyErr_Clear();
161			fclose(fp);
162               } else {
163			int save_errno;
164			save_errno = errno;
165			PySys_WriteStderr("Could not open PYTHONSTARTUP\n");
166			errno = save_errno;
167			PyErr_SetFromErrnoWithFilename(PyExc_IOError,
168						       startup);
169			PyErr_Print();
170			PyErr_Clear();
171		}
172	}
173}
174
175
176static int RunModule(char *module, int set_argv0)
177{
178	PyObject *runpy, *runmodule, *runargs, *result;
179	runpy = PyImport_ImportModule("runpy");
180	if (runpy == NULL) {
181		fprintf(stderr, "Could not import runpy module\n");
182		return -1;
183	}
184	runmodule = PyObject_GetAttrString(runpy, "_run_module_as_main");
185	if (runmodule == NULL) {
186		fprintf(stderr, "Could not access runpy._run_module_as_main\n");
187		Py_DECREF(runpy);
188		return -1;
189	}
190	runargs = Py_BuildValue("(si)", module, set_argv0);
191	if (runargs == NULL) {
192		fprintf(stderr,
193			"Could not create arguments for runpy._run_module_as_main\n");
194		Py_DECREF(runpy);
195		Py_DECREF(runmodule);
196		return -1;
197	}
198	result = PyObject_Call(runmodule, runargs, NULL);
199	if (result == NULL) {
200		PyErr_Print();
201	}
202	Py_DECREF(runpy);
203	Py_DECREF(runmodule);
204	Py_DECREF(runargs);
205	if (result == NULL) {
206		return -1;
207	}
208	Py_DECREF(result);
209	return 0;
210}
211
212static int RunMainFromImporter(char *filename)
213{
214	PyObject *argv0 = NULL, *importer = NULL;
215
216	if ((argv0 = PyString_FromString(filename)) &&
217	    (importer = PyImport_GetImporter(argv0)) &&
218	    (importer->ob_type != &PyNullImporter_Type))
219	{
220		 /* argv0 is usable as an import source, so
221			put it in sys.path[0] and import __main__ */
222		PyObject *sys_path = NULL;
223		if ((sys_path = PySys_GetObject("path")) &&
224		    !PyList_SetItem(sys_path, 0, argv0))
225		{
226			Py_INCREF(argv0);
227			Py_DECREF(importer);
228			sys_path = NULL;
229			return RunModule("__main__", 0) != 0;
230		}
231	}
232	Py_XDECREF(argv0);
233	Py_XDECREF(importer);
234	if (PyErr_Occurred()) {
235		PyErr_Print();
236		return 1;
237	}
238	return -1;
239}
240
241
242/* Main program */
243
244int
245Py_Main(int argc, char **argv)
246{
247	int c;
248	int sts;
249	char *command = NULL;
250	char *filename = NULL;
251	char *module = NULL;
252	FILE *fp = stdin;
253	char *p;
254	int unbuffered = 0;
255	int skipfirstline = 0;
256	int stdin_is_interactive = 0;
257	int help = 0;
258	int version = 0;
259	int saw_unbuffered_flag = 0;
260	PyCompilerFlags cf;
261
262	cf.cf_flags = 0;
263
264	orig_argc = argc;	/* For Py_GetArgcArgv() */
265	orig_argv = argv;
266
267#ifdef RISCOS
268	Py_RISCOSWimpFlag = 0;
269#endif
270
271	PySys_ResetWarnOptions();
272
273	while ((c = _PyOS_GetOpt(argc, argv, PROGRAM_OPTS)) != EOF) {
274		if (c == 'c') {
275			/* -c is the last option; following arguments
276			   that look like options are left for the
277			   command to interpret. */
278			command = (char *)malloc(strlen(_PyOS_optarg) + 2);
279			if (command == NULL)
280				Py_FatalError(
281				   "not enough memory to copy -c argument");
282			strcpy(command, _PyOS_optarg);
283			strcat(command, "\n");
284			break;
285		}
286
287		if (c == 'm') {
288			/* -m is the last option; following arguments
289			   that look like options are left for the
290			   module to interpret. */
291			module = (char *)malloc(strlen(_PyOS_optarg) + 2);
292			if (module == NULL)
293				Py_FatalError(
294				   "not enough memory to copy -m argument");
295			strcpy(module, _PyOS_optarg);
296			break;
297		}
298
299		switch (c) {
300		case 'b':
301			Py_BytesWarningFlag++;
302			break;
303
304		case 'd':
305			Py_DebugFlag++;
306			break;
307
308		case '3':
309#ifdef WITH_PY3K_WARNINGS
310			Py_Py3kWarningFlag++;
311			if (!Py_DivisionWarningFlag)
312				Py_DivisionWarningFlag = 1;
313#else
314			Py_FatalError("Py3k warnings are disabled in this "
315				      "build of Python");
316#endif
317			break;
318
319		case 'R':
320#ifdef Py_REF_DEBUG
321			Py_ShowRefcountFlag++;
322#else
323			Py_FatalError("-R requires a debug build of Python");
324#endif
325			break;
326
327		case 'Q':
328			if (strcmp(_PyOS_optarg, "old") == 0) {
329				Py_DivisionWarningFlag = 0;
330				break;
331			}
332			if (strcmp(_PyOS_optarg, "warn") == 0) {
333				Py_DivisionWarningFlag = 1;
334				break;
335			}
336			if (strcmp(_PyOS_optarg, "warnall") == 0) {
337				Py_DivisionWarningFlag = 2;
338				break;
339			}
340			if (strcmp(_PyOS_optarg, "new") == 0) {
341				/* This only affects __main__ */
342				cf.cf_flags |= CO_FUTURE_DIVISION;
343				/* And this tells the eval loop to treat
344				   BINARY_DIVIDE as BINARY_TRUE_DIVIDE */
345				_Py_QnewFlag = 1;
346				break;
347			}
348			fprintf(stderr,
349				"-Q option should be `-Qold', "
350				"`-Qwarn', `-Qwarnall', or `-Qnew' only\n");
351			return usage(2, argv[0]);
352			/* NOTREACHED */
353
354		case 'i':
355			Py_InspectFlag++;
356			Py_InteractiveFlag++;
357			break;
358
359                case 'X':
360#ifdef WITH_LLVM
361			/* Support both -Xjit=never and -Xjit never is a huge
362			   hassle due to the way _PyOS_GetOpt() works. This
363			   whole system should be replaced with something more
364			   flexible. */
365			if (strncmp(_PyOS_optarg, "jit=", 4) == 0) {
366				int r = Py_JitControlStrToEnum(_PyOS_optarg + 4,
367				                               &Py_JitControl);
368				if (r >= 0)
369					break;  /* Success */
370
371				fprintf(stderr,
372				        "-Xjit value should be `whenhot'"
373				        ", `always`, or `never', not `%s'\n",
374				        _PyOS_optarg);
375			} else
376#endif  /* WITH_LLVM */
377			if (strchr(_PyOS_optarg, '=') == NULL) {
378				fprintf(stderr,
379				        "-Xfoo flags require = to separate args"
380				        " (`-Xfoo=bar', not `-Xfoo bar')\n");
381			} else {
382				fprintf(stderr,
383				        "Unknown -X option: `%s'\n",
384				        _PyOS_optarg);
385			}
386			return usage(2, argv[0]);
387			/* NOTREACHED */
388
389		/* case 'J': reserved for Jython */
390
391		case 'O':
392			if (_PyOS_optarg[0] == '0') {
393				Py_OptimizeFlag = 0;
394				break;
395			}
396			/* \0 indicates no argument was found. */
397			if (_PyOS_optarg[0] == '\0') {
398				Py_OptimizeFlag = 1;
399				break;
400			} else if (_PyOS_optarg[1] == '\0') {
401				if (_PyOS_optarg[0] == '1') {
402					Py_OptimizeFlag = 1;
403					break;
404				}
405				if (_PyOS_optarg[0] == '2' ||
406				    _PyOS_optarg[0] == 'O') {
407					Py_OptimizeFlag = 2;
408					break;
409				}
410			}
411			fprintf(stderr,
412				"-O argument should be 0, 1, or 2\n");
413			return usage(2, argv[0]);
414			/* NOTREACHED */
415
416		case 'B':
417			Py_DontWriteBytecodeFlag++;
418			break;
419
420		case 's':
421			Py_NoUserSiteDirectory++;
422			break;
423
424		case 'S':
425			Py_NoSiteFlag++;
426			break;
427
428		case 'E':
429			Py_IgnoreEnvironmentFlag++;
430			break;
431
432		case 't':
433			Py_TabcheckFlag++;
434			break;
435
436		case 'u':
437			unbuffered++;
438			saw_unbuffered_flag = 1;
439			break;
440
441		case 'v':
442			Py_VerboseFlag++;
443			break;
444
445#ifdef RISCOS
446		case 'w':
447			Py_RISCOSWimpFlag = 1;
448			break;
449#endif
450
451		case 'x':
452			skipfirstline = 1;
453			break;
454
455		/* case 'X': reserved for implementation-specific arguments */
456
457		case 'U':
458			Py_UnicodeFlag++;
459			break;
460		case 'h':
461		case '?':
462			help++;
463			break;
464		case 'V':
465			version++;
466			break;
467
468		case 'W':
469			PySys_AddWarnOption(_PyOS_optarg);
470			break;
471
472		/* This space reserved for other options */
473
474		default:
475			return usage(2, argv[0]);
476			/*NOTREACHED*/
477
478		}
479	}
480
481	if (help)
482		return usage(0, argv[0]);
483
484	if (version) {
485		fprintf(stderr, "Python %s\n", PY_VERSION);
486		return 0;
487	}
488
489	if (!Py_InspectFlag &&
490	    (p = Py_GETENV("PYTHONINSPECT")) && *p != '\0')
491		Py_InspectFlag = 1;
492	if (!saw_unbuffered_flag &&
493	    (p = Py_GETENV("PYTHONUNBUFFERED")) && *p != '\0')
494		unbuffered = 1;
495
496	if (!Py_NoUserSiteDirectory &&
497	    (p = Py_GETENV("PYTHONNOUSERSITE")) && *p != '\0')
498		Py_NoUserSiteDirectory = 1;
499
500	if (command == NULL && module == NULL && _PyOS_optind < argc &&
501	    strcmp(argv[_PyOS_optind], "-") != 0)
502	{
503#ifdef __VMS
504		filename = decc$translate_vms(argv[_PyOS_optind]);
505		if (filename == (char *)0 || filename == (char *)-1)
506			filename = argv[_PyOS_optind];
507
508#else
509		filename = argv[_PyOS_optind];
510#endif
511	}
512
513	stdin_is_interactive = Py_FdIsInteractive(stdin, (char *)0);
514
515	if (unbuffered) {
516#if defined(MS_WINDOWS) || defined(__CYGWIN__)
517		_setmode(fileno(stdin), O_BINARY);
518		_setmode(fileno(stdout), O_BINARY);
519#endif
520#ifdef HAVE_SETVBUF
521		setvbuf(stdin,  (char *)NULL, _IONBF, BUFSIZ);
522		setvbuf(stdout, (char *)NULL, _IONBF, BUFSIZ);
523		setvbuf(stderr, (char *)NULL, _IONBF, BUFSIZ);
524#else /* !HAVE_SETVBUF */
525		setbuf(stdin,  (char *)NULL);
526		setbuf(stdout, (char *)NULL);
527		setbuf(stderr, (char *)NULL);
528#endif /* !HAVE_SETVBUF */
529	}
530	else if (Py_InteractiveFlag) {
531#ifdef MS_WINDOWS
532		/* Doesn't have to have line-buffered -- use unbuffered */
533		/* Any set[v]buf(stdin, ...) screws up Tkinter :-( */
534		setvbuf(stdout, (char *)NULL, _IONBF, BUFSIZ);
535#else /* !MS_WINDOWS */
536#ifdef HAVE_SETVBUF
537		setvbuf(stdin,  (char *)NULL, _IOLBF, BUFSIZ);
538		setvbuf(stdout, (char *)NULL, _IOLBF, BUFSIZ);
539#endif /* HAVE_SETVBUF */
540#endif /* !MS_WINDOWS */
541		/* Leave stderr alone - it should be unbuffered anyway. */
542  	}
543#ifdef __VMS
544	else {
545		setvbuf (stdout, (char *)NULL, _IOLBF, BUFSIZ);
546	}
547#endif /* __VMS */
548
549#ifdef __APPLE__
550	/* On MacOS X, when the Python interpreter is embedded in an
551	   application bundle, it gets executed by a bootstrapping script
552	   that does os.execve() with an argv[0] that's different from the
553	   actual Python executable. This is needed to keep the Finder happy,
554	   or rather, to work around Apple's overly strict requirements of
555	   the process name. However, we still need a usable sys.executable,
556	   so the actual executable path is passed in an environment variable.
557	   See Lib/plat-mac/bundlebuiler.py for details about the bootstrap
558	   script. */
559	if ((p = Py_GETENV("PYTHONEXECUTABLE")) && *p != '\0')
560		Py_SetProgramName(p);
561	else
562		Py_SetProgramName(argv[0]);
563#else
564	Py_SetProgramName(argv[0]);
565#endif
566	Py_Initialize();
567
568	if (Py_VerboseFlag ||
569	    (command == NULL && filename == NULL && module == NULL && stdin_is_interactive)) {
570		fprintf(stderr, "Python %s on %s\n",
571			Py_GetVersion(), Py_GetPlatform());
572		fprintf(stderr, "[Unladen Swallow %s]\n", UNLADEN_VERSION);
573 		if (!Py_NoSiteFlag)
574 			fprintf(stderr, "%s\n", COPYRIGHT);
575	}
576
577	if (command != NULL) {
578		/* Backup _PyOS_optind and force sys.argv[0] = '-c' */
579		_PyOS_optind--;
580		argv[_PyOS_optind] = "-c";
581	}
582
583	if (module != NULL) {
584		/* Backup _PyOS_optind and force sys.argv[0] = '-c'
585		   so that PySys_SetArgv correctly sets sys.path[0] to ''*/
586		_PyOS_optind--;
587		argv[_PyOS_optind] = "-c";
588	}
589
590	PySys_SetArgv(argc-_PyOS_optind, argv+_PyOS_optind);
591
592	if ((Py_InspectFlag || (command == NULL && filename == NULL && module == NULL)) &&
593	    isatty(fileno(stdin))) {
594		PyObject *v;
595		v = PyImport_ImportModule("readline");
596		if (v == NULL)
597			PyErr_Clear();
598		else
599			Py_DECREF(v);
600	}
601
602	if (command) {
603		sts = PyRun_SimpleStringFlags(command, &cf) != 0;
604		free(command);
605	} else if (module) {
606		sts = RunModule(module, 1);
607		free(module);
608	}
609	else {
610
611		if (filename == NULL && stdin_is_interactive) {
612			Py_InspectFlag = 0; /* do exit on SystemExit */
613			RunStartupFile(&cf);
614		}
615		/* XXX */
616
617		sts = -1;	/* keep track of whether we've already run __main__ */
618
619		if (filename != NULL) {
620			sts = RunMainFromImporter(filename);
621		}
622
623		if (sts==-1 && filename!=NULL) {
624			if ((fp = fopen(filename, "r")) == NULL) {
625				fprintf(stderr, "%s: can't open file '%s': [Errno %d] %s\n",
626					argv[0], filename, errno, strerror(errno));
627
628				return 2;
629			}
630			else if (skipfirstline) {
631				int ch;
632				/* Push back first newline so line numbers
633				   remain the same */
634				while ((ch = getc(fp)) != EOF) {
635					if (ch == '\n') {
636						(void)ungetc(ch, fp);
637						break;
638					}
639				}
640			}
641			{
642				/* XXX: does this work on Win/Win64? (see posix_fstat) */
643				struct stat sb;
644				if (fstat(fileno(fp), &sb) == 0 &&
645				    S_ISDIR(sb.st_mode)) {
646					fprintf(stderr, "%s: '%s' is a directory, cannot continue\n", argv[0], filename);
647					fclose(fp);
648					return 1;
649				}
650			}
651		}
652
653		if (sts==-1) {
654			sts = PyRun_AnyFileExFlags(
655				fp,
656				filename == NULL ? "<stdin>" : filename,
657				filename != NULL, &cf) != 0;
658		}
659		
660	}
661
662	/* Check this environment variable at the end, to give programs the
663	 * opportunity to set it from Python.
664	 */
665	if (!Py_InspectFlag &&
666	    (p = Py_GETENV("PYTHONINSPECT")) && *p != '\0')
667	{
668		Py_InspectFlag = 1;
669	}
670
671	if (Py_InspectFlag && stdin_is_interactive &&
672	    (filename != NULL || command != NULL || module != NULL)) {
673		Py_InspectFlag = 0;
674		/* XXX */
675		sts = PyRun_AnyFileFlags(stdin, "<stdin>", &cf) != 0;
676	}
677
678	Py_WaitForThreadShutdown();
679
680	Py_Finalize();
681#ifdef RISCOS
682	if (Py_RISCOSWimpFlag)
683                fprintf(stderr, "\x0cq\x0c"); /* make frontend quit */
684#endif
685
686#ifdef __INSURE__
687	/* Insure++ is a memory analysis tool that aids in discovering
688	 * memory leaks and other memory problems.  On Python exit, the
689	 * interned string dictionary is flagged as being in use at exit
690	 * (which it is).  Under normal circumstances, this is fine because
691	 * the memory will be automatically reclaimed by the system.  Under
692	 * memory debugging, it's a huge source of useless noise, so we
693	 * trade off slower shutdown for less distraction in the memory
694	 * reports.  -baw
695	 */
696	_Py_ReleaseInternedStrings();
697#endif /* __INSURE__ */
698
699	return sts;
700}
701
702/* this is gonna seem *real weird*, but if you put some other code between
703   Py_Main() and Py_GetArgcArgv() you will need to adjust the test in the
704   while statement in Misc/gdbinit:ppystack */
705
706/* Make the *original* argc/argv available to other modules.
707   This is rare, but it is needed by the secureware extension. */
708
709void
710Py_GetArgcArgv(int *argc, char ***argv)
711{
712	*argc = orig_argc;
713	*argv = orig_argv;
714}
715
716#ifdef __cplusplus
717}
718#endif