[Python-checkins] python/dist/src/Modules main.c,1.77,1.78

bwarsaw@users.sourceforge.net bwarsaw@users.sourceforge.net
Sun, 29 Jun 2003 10:07:09 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv25742

Modified Files:
	main.c 
Log Message:
Py_Main(): Add a check for the PYTHONINSPECT environment variable
after running the script so that a program could do something like:

os.environ['PYTHONINSPECT'] = 1

to programmatically enter a prompt at the end.

(After a patch by Skip Montanaro w/ proposal by Troy Melhase


Index: main.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/main.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -C2 -d -r1.77 -r1.78
*** main.c	30 Mar 2003 17:09:58 -0000	1.77
--- main.c	29 Jun 2003 17:07:06 -0000	1.78
***************
*** 419,422 ****
--- 419,431 ----
  	}
  
+ 	/* Check this environment variable at the end, to give programs the
+ 	 * opportunity to set it from Python.
+ 	 */
+ 	if (!saw_inspect_flag &&
+ 	    (p = Py_GETENV("PYTHONINSPECT")) && *p != '\0')
+ 	{
+ 		inspect = 1;
+ 	}
+ 
  	if (inspect && stdin_is_interactive &&
  	    (filename != NULL || command != NULL))