summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2003-06-29 17:07:06 (GMT)
committerBarry Warsaw <barry@python.org>2003-06-29 17:07:06 (GMT)
commitd86dcd35540327ac7ba559e8c7852bd82ab84ce7 (patch)
tree756f37afb6686d6b748d0c8df840f354a7209606 /Modules
parente3a565eed0a8870e5f8b5d05040c0207ee99140f (diff)
downloadcpython-d86dcd35540327ac7ba559e8c7852bd82ab84ce7.zip
cpython-d86dcd35540327ac7ba559e8c7852bd82ab84ce7.tar.gz
cpython-d86dcd35540327ac7ba559e8c7852bd82ab84ce7.tar.bz2
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
Diffstat (limited to 'Modules')
-rw-r--r--Modules/main.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/Modules/main.c b/Modules/main.c
index 50440b3..83721da 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 */