From: Barry Warsaw Date: Sun, 29 Jun 2003 17:07:06 +0000 (+0000) Subject: Py_Main(): Add a check for the PYTHONINSPECT environment variable X-Git-Tag: v2.3c1~243 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d86dcd35540327ac7ba559e8c7852bd82ab84ce7;p=thirdparty%2FPython%2Fcpython.git 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 --- diff --git a/Modules/main.c b/Modules/main.c index 50440b33b285..83721da660d9 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -418,6 +418,15 @@ Py_Main(int argc, char **argv) filename != NULL, &cf) != 0; } + /* 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)) /* XXX */